Skip to content

Commit fd31f8f

Browse files
Copilotpylapp
andcommitted
Rename ouds-prefixed public methods and OUDSButtonStyle to StyleForButton
Agent-Logs-Url: https://github.com/Orange-OpenSource/ouds-ios/sessions/1e08d090-da57-4d99-bb37-f7e5698a17ce Co-authored-by: pylapp <7559007+pylapp@users.noreply.github.com>
1 parent da15b32 commit fd31f8f

File tree

70 files changed

+437
-143
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+437
-143
lines changed

AGENTS.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,28 +175,35 @@ the dedicated OUDS view modifier with the same name as the typography, i.e. `bod
175175
#### Background and foreground color
176176

177177
OUDS framework provides a SwiftUI view modifier to apply foreground color (using a token).
178-
For example if a user want to apply in foreground the color `theme.colors.contentDefault`, he must not use the `foregroundColor()` method from SwiftUI but instead
179-
the dedicated OUDS view modifier `oudsForegroundColor(color)`.
178+
For example if a user want to apply in foreground the color `theme.colors.contentDefault`, use
179+
the dedicated OUDS overload of `foregroundColor(_:)` passing a `MultipleColorSemanticToken`:
180+
```swift
181+
.foregroundColor(theme.colors.contentDefault)
182+
```
180183

181-
The logic is the same for `backgroundColor` which must be replaced by `oudsBackground(color)`.
184+
The logic is the same for background color which must use the dedicated OUDS overload of `background(_:)`:
185+
```swift
186+
.background(theme.colors.bgPrimary)
187+
```
182188

183189
#### Add border
184190

185-
Border can be defined using the OUDS view modifier `oudsBorder(style:width:radius:color)` with tokens in parameters like:
191+
Border can be defined using the OUDS overload of `border(style:width:radius:color:)` with tokens in parameters like:
186192
```swift
187-
.oudsBorder(style: theme.borders.styleDefault,
188-
width: theme.borders.widthThin,
189-
radius: theme.borders.radiusMedium,
190-
color: theme.colors.actionEnabled)
193+
.border(style: theme.borders.styleDefault,
194+
width: theme.borders.widthThin,
195+
radius: theme.borders.radiusMedium,
196+
color: theme.colors.actionEnabled)
191197
```
192198

193199
#### Add shadow / elevation effect
194200

195-
Elevations effets or box shadows can be applied to view with a dedicated view modifier `oudsShadow(elevation)` with an elevation token like:
201+
Elevations effets or box shadows can be applied to view with the dedicated OUDS overload of `shadow(_:)` with an elevation token like:
196202
```swift
197-
.oudsShadow(theme.elevations.emphasized)
203+
.shadow(theme.elevations.emphasized)
198204
```
199205

206+
200207
### 3.8 Use components
201208

202209
#### Actions

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased](https://github.com/Orange-OpenSource/ouds-ios/compare/1.3.0...develop)
88

9+
### Added
10+
11+
- New unprefixed `View` extension methods as non-deprecated alternatives to the deprecated `ouds`-prefixed ones (Orange-OpenSource/ouds-ios#1352)
12+
13+
### Changed
14+
15+
- Rename internal `OUDSButtonStyle` to `StyleForButton` (Orange-OpenSource/ouds-ios#1352)
16+
17+
### Deprecated
18+
19+
- `View.oudsForegroundStyle(_:)` replaced by `View.foregroundStyle(_:)` (Orange-OpenSource/ouds-ios#1352)
20+
- `View.oudsForegroundColor(_:)` replaced by `View.foregroundColor(_:)` (Orange-OpenSource/ouds-ios#1352)
21+
- `View.oudsBackground(_:)` replaced by `View.background(_:)` (Orange-OpenSource/ouds-ios#1352)
22+
- `View.oudsAccentColor(_:)` replaced by `View.accentColor(_:)` (Orange-OpenSource/ouds-ios#1352)
23+
- `View.oudsShadow(_:)` replaced by `View.shadow(_:)` (Orange-OpenSource/ouds-ios#1352)
24+
- `View.oudsBorder(style:width:radius:color:)` replaced by `View.border(style:width:radius:color:)` (Orange-OpenSource/ouds-ios#1352)
25+
- `View.oudsColoredSurface(_:)` replaced by `View.coloredSurface(_:)` (Orange-OpenSource/ouds-ios#1352)
26+
- `View.oudsGridMargin(_:)` replaced by `View.gridMargin(_:)` (Orange-OpenSource/ouds-ios#1352)
27+
- `View.oudsRequestAccessibleFocus(_:)` replaced by `View.requestAccessibleFocus(_:)` (Orange-OpenSource/ouds-ios#1352)
28+
- `View.oudsRequestAccessibleFocus(_:for:)` replaced by `View.requestAccessibleFocus(_:for:)` (Orange-OpenSource/ouds-ios#1352)
29+
- `Divider.oudsHorizontalDivider(dividerColor:)` replaced by `Divider.horizontalDivider(dividerColor:)` (Orange-OpenSource/ouds-ios#1352)
30+
- `Divider.oudsVerticalDivider(color:)` replaced by `Divider.verticalDivider(color:)` (Orange-OpenSource/ouds-ios#1352)
31+
932
## [1.3.0](https://github.com/Orange-OpenSource/ouds-ios/compare/1.2.0...1.3.0) - 2026-03-26
1033

1134
### Added

MIGRATION.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,86 @@
11
# Migration Guide
22

3+
- [v1.3.0 → v1.4.0](#v130--v140)
34
- [v1.2.0 → v1.3.0](#v120--v130)
45
- [v1.1.0 → v1.2.0](#v110--v120)
56
- [v1.0.0 → v1.1.0](#v100--v110)
67
- [Support](#support)
78

9+
## v1.3.0 → v1.4.0
10+
11+
### Overview
12+
13+
Some public `View` extension methods prefixed with `ouds` have been renamed to remove the prefix, aligning with the naming style of typography helpers.
14+
The old methods are deprecated and will be removed in a future version.
15+
The internal `OUDSButtonStyle` struct has been renamed to `StyleForButton`.
16+
17+
### Before You Begin
18+
19+
#### Prerequisites
20+
21+
- Use version 1.3 or older
22+
23+
### Deprecated API
24+
25+
#### 1. Renamed `View` extension methods (deprecated, not removed)
26+
27+
The following `View` extension methods have been deprecated in favor of unprefixed versions.
28+
The old methods still compile with a deprecation warning.
29+
30+
**Impact**: Low
31+
32+
| Deprecated | Replacement |
33+
|---|---|
34+
| `.oudsForegroundStyle(_:)` | `.foregroundStyle(_:)` |
35+
| `.oudsForegroundColor(_:)` | `.foregroundColor(_:)` |
36+
| `.oudsBackground(_:)` | `.background(_:)` |
37+
| `.oudsAccentColor(_:)` | `.accentColor(_:)` |
38+
| `.oudsShadow(_:)` | `.shadow(_:)` |
39+
| `.oudsBorder(style:width:radius:color:)` | `.border(style:width:radius:color:)` |
40+
| `.oudsColoredSurface(_:)` | `.coloredSurface(_:)` |
41+
| `.oudsGridMargin(_:)` | `.gridMargin(_:)` |
42+
| `.oudsRequestAccessibleFocus(_:)` | `.requestAccessibleFocus(_:)` |
43+
| `.oudsRequestAccessibleFocus(_:for:)` | `.requestAccessibleFocus(_:for:)` |
44+
| `.oudsHorizontalDivider(dividerColor:)` | `.horizontalDivider(dividerColor:)` |
45+
| `.oudsVerticalDivider(color:)` | `.verticalDivider(color:)` |
46+
47+
**Before (v1.3.x)**:
48+
```swift
49+
Text("Hello")
50+
.oudsForegroundColor(theme.colors.contentDefault)
51+
.oudsBackground(theme.colors.bgPrimary)
52+
53+
SomeView()
54+
.oudsBorder(style: theme.borders.styleDefault,
55+
width: theme.borders.widthThin,
56+
radius: theme.borders.radiusMedium,
57+
color: theme.colors.borderDefault)
58+
.oudsShadow(theme.elevations.emphasized)
59+
```
60+
61+
**After (v1.4.0)**:
62+
```swift
63+
Text("Hello")
64+
.foregroundColor(theme.colors.contentDefault)
65+
.background(theme.colors.bgPrimary)
66+
67+
SomeView()
68+
.border(style: theme.borders.styleDefault,
69+
width: theme.borders.widthThin,
70+
radius: theme.borders.radiusMedium,
71+
color: theme.colors.borderDefault)
72+
.shadow(theme.elevations.emphasized)
73+
```
74+
75+
**Required Action**:
76+
- Replace deprecated `ouds`-prefixed calls with their unprefixed counterparts
77+
78+
**Reason for Change**: User feedback indicated the `ouds` prefix on methods was redundant and verbose given that parameter types are strongly typed OUDS tokens which prevent any ambiguity with native SwiftUI overloads.
79+
80+
#### 2. Rename of internal `OUDSButtonStyle` to `StyleForButton`
81+
82+
**Impact**: None (internal type, not exposed in the public API)
83+
884
## v1.2.0 → v1.3.0
985

1086
### Overview

OUDS/Core/Components/Sources/Actions/Button/Internal/ButtonStyle+BackgroundModifier.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct ButtonBackgroundModifier: ViewModifier {
3131

3232
func body(content: Content) -> some View {
3333
if let appliedColor {
34-
content.oudsBackground(appliedColor)
34+
content.background(appliedColor)
3535
} else {
3636
content
3737
}

OUDS/Core/Components/Sources/Actions/Button/Internal/ButtonStyle+BorderModifier.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ struct ButtonBorderModifier: ViewModifier {
3636
switch appearance {
3737
case .default:
3838
content
39-
.oudsBorder(
39+
.border(
4040
style: theme.borders.styleDefault,
4141
width: defaultWidth,
4242
radius: radius,
4343
color: defaultColor)
4444
case .strong:
4545
if onColoredSurface {
4646
content
47-
.oudsBorder(
47+
.border(
4848
style: theme.borders.styleDefault,
4949
width: defaultWidth,
5050
radius: radius,

OUDS/Core/Components/Sources/Actions/Button/Internal/ButtonStyle.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import SwiftUI
3232
/// - **normal**: is the normal state of a button which can be disabled, pressed, hovered or normal (i.e. enabled)
3333
/// - **loading**: the style used after button was clicked and probably data are requested before navigate to a next screen or get updated data.
3434
///
35-
struct OUDSButtonStyle: ButtonStyle {
35+
struct StyleForButton: ButtonStyle {
3636

3737
// MARK: Stored Properties
3838

@@ -45,7 +45,7 @@ struct OUDSButtonStyle: ButtonStyle {
4545

4646
// MARK: Initializer
4747

48-
/// Initialize the `OUDSButtonStyle` for the `appearance`
48+
/// Initialize the `StyleForButton` for the `appearance`
4949
/// and the `style` of the `OUDSButton`.
5050
///
5151
/// - Parameters:

OUDS/Core/Components/Sources/Actions/Button/OUDSButton.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public struct OUDSButton: View {
268268
ButtonTextAndIcon(text: text, icon: icon, flipIcon: flipped)
269269
}
270270
}
271-
.buttonStyle(OUDSButtonStyle(appearance: appearance, style: style, isHover: isHover, isFullWidth: isFullWidth))
271+
.buttonStyle(StyleForButton(appearance: appearance, style: style, isHover: isHover, isFullWidth: isFullWidth))
272272
.disabled(style == .loading)
273273
.accessibilityLabel(accessibilityLabel)
274274
#if !os(watchOS) && !os(tvOS)

OUDS/Core/Components/Sources/ContentDisplay/BulletList/Internal/Bullet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ struct UnorderedBullet: View {
9696

9797
var body: some View {
9898
ScaledIcon(icon: image.renderingMode(.template), size: assetSize)
99-
.oudsForegroundColor(color)
99+
.foregroundColor(color)
100100
}
101101

102102
// MARK: Private helpers

OUDS/Core/Components/Sources/Controls/Checkbox/Internal/CheckboxBackgroundColorModifier.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ struct CheckboxBackgroundColorModifier: ViewModifier {
3030
case .enabled, .disabled, .readOnly:
3131
content
3232
case .hover:
33-
content.oudsBackground(theme.controlItem.colorBgHover)
33+
content.background(theme.controlItem.colorBgHover)
3434
.clipShape(RoundedRectangle(cornerRadius: theme.controlItem.borderRadiusItemOnly))
3535
case .pressed:
36-
content.oudsBackground(theme.controlItem.colorBgPressed)
36+
content.background(theme.controlItem.colorBgPressed)
3737
.clipShape(RoundedRectangle(cornerRadius: theme.controlItem.borderRadiusItemOnly))
3838
}
3939
}

OUDS/Core/Components/Sources/Controls/Checkbox/Internal/CheckboxIndicator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct CheckboxIndicator: View {
5959
.renderingMode(.template)
6060
.scaledToFit()
6161
.accessibilityHidden(true)
62-
.oudsForegroundColor(appliedColor)
62+
.foregroundColor(appliedColor)
6363
}
6464

6565
private var appliedColor: MultipleColorSemanticToken {

0 commit comments

Comments
 (0)