Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,41 +175,38 @@ the dedicated OUDS view modifier with the same name as the typography, i.e. `bod
#### Apply colors

OUDS framework provides SwiftUI view modifiers to apply colors (using tokens).
For example, given the token of color `theme.colors.contentDefault`=

For example if a user want to apply in foreground the color `theme.colors.contentDefault`, use
the dedicated OUDS overload of `foregroundColor(_:)` passing a `MultipleColorSemanticToken`:
```swift
// Change foreground color
view.oudsForegroundColor(theme.colors.contentDefault) // DO
view.foregroundColor(theme.colors.contentDefault) // DON'T

// Change tint color
view.oudsTintColor(theme.colors.contentDefault) // DO
view.tintColor(theme.colors.contentDefault) // DON'T
.foregroundColor(theme.colors.contentDefault)
```

// Change accent color
view.oudsAccentColor(theme.colors.contentDefault) // DO
view.accentColor(theme.colors.contentDefault) // DON'T
The logic is the same for background color which must use the dedicated OUDS overload of `background(_:)`:
```swift
.background(theme.colors.bgPrimary)
```

// Change background color
view.oudsBackground(theme.colors.contentDefault) // DO
view.background(theme.colors.contentDefault) // DON'T
The logic is the same for tint color which must use the dedicated OUDS overload of `tint(_:)`:
```swift
.tint(theme.colors.contentDefault)
```

#### Add border

Border can be defined using the OUDS view modifier `oudsBorder(style:width:radius:color)` with tokens in parameters like:
Border can be defined using the OUDS overload of `border(style:width:radius:color:)` with tokens in parameters like:
```swift
.oudsBorder(style: theme.borders.styleDefault,
width: theme.borders.widthThin,
radius: theme.borders.radiusMedium,
color: theme.colors.actionEnabled)
.border(style: theme.borders.styleDefault,
width: theme.borders.widthThin,
radius: theme.borders.radiusMedium,
color: theme.colors.actionEnabled)
```

#### Add shadow / elevation effect

Elevations effets or box shadows can be applied to view with a dedicated view modifier `oudsShadow(elevation)` with an elevation token like:
Elevations effets or box shadows can be applied to view with the dedicated OUDS overload of `shadow(_:)` with an elevation token like:
```swift
.oudsShadow(theme.elevations.emphasized)
.shadow(theme.elevations.emphasized)
```

### 3.8 Use components
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- View modifiers and methods prefixed by `ouds` are replaced by same names without such `ouds` (Orange-OpenSource/ouds-ios#1346)
- Move from Xcode 26.2 to Xcode 26.3 (Orange-OpenSource/ouds-ios#1375)

## [1.3.0](https://github.com/Orange-OpenSource/ouds-ios/compare/1.2.0...1.3.0) - 2026-03-26
Expand Down
88 changes: 88 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,88 @@
# Migration Guide

- [v1.3.0 → v1.4.0](#v130--v140)
- [v1.2.0 → v1.3.0](#v120--v130)
- [v1.1.0 → v1.2.0](#v110--v120)
- [v1.0.0 → v1.1.0](#v100--v110)
- [Support](#support)

## v1.3.0 → v1.4.0

### Overview

Some public `View` extension methods prefixed with `ouds` have been renamed to remove the prefix, aligning with the naming style of typography helpers.
The old methods are deprecated and will be removed in a future major version.

### Before You Begin

#### Prerequisites

- Use version 1.3 or older

### Deprecated API

#### Renamed `View` extension methods (deprecated, not removed)

The following `View` extension methods have been deprecated in favor of unprefixed versions.
The old methods still compile with a deprecation warning.

**Impact**: Low

| Deprecated | Replacement |
|----------------------------------------------|--------------------------------------|
| `.oudsForegroundStyle(_:)` | `.foregroundStyle(_:)` |
| `.oudsForegroundColor(_:)` | `.foregroundColor(_:)` |
| `.oudsBackground(_:)` | `.background(_:)` |
| `.oudsAccentColor(_:)` | `.accentColor(_:)` |
| `.oudsShadow(_:)` | `.shadow(_:)` |
| `.oudsBorder(style:width:radius:color:)` | `.border(style:width:radius:color:)` |
| `.oudsColoredSurface(_:)` | `.coloredSurface(_:)` |
| `.oudsGridMargin(_:)` | `.gridMargin(_:)` |
| `.oudsRequestAccessibleFocus(_:)` | `.requestAccessibleFocus(_:)` |
| `.oudsRequestAccessibleFocus(_:for:)` | `.requestAccessibleFocus(_:for:)` |
| `.oudsHorizontalDivider(dividerColor:)` | `.horizontal(color:)` |
| `.oudsVerticalDivider(color:)` | `.vertical(color:)` |

**Before (v1.3.x)**:
```swift
Text("Hello")
.oudsForegroundColor(theme.colors.contentDefault)
.oudsBackground(theme.colors.bgPrimary)
// Etc.

SomeView()
.oudsBorder(style: theme.borders.styleDefault,
width: theme.borders.widthThin,
radius: theme.borders.radiusMedium,
color: theme.colors.borderDefault)
.oudsShadow(theme.elevations.emphasized)
// Etc.
```

**After (v1.4.0)**:
```swift
Text("Hello")
.foregroundColor(theme.colors.contentDefault)
.background(theme.colors.bgPrimary)

SomeView()
.border(style: theme.borders.styleDefault,
width: theme.borders.widthThin,
radius: theme.borders.radiusMedium,
color: theme.colors.borderDefault)
.shadow(theme.elevations.emphasized)
```

**Required Action**:
- Replace deprecated `ouds`-prefixed calls with their unprefixed counterparts

**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.

### Compatibility

- **Backward Compatibility**: No
- **v1.4.0 Support**: Until release of next minor version

## v1.2.0 → v1.3.0

### Overview
Expand Down Expand Up @@ -63,6 +141,11 @@ var someIconForBulletList: OUDSBulletList.UnorderedAsset {

**Reason for Change**: "asset" word has a better meaning than "icon", and is aligned with Android OUDS library API

### Compatibility

- **Backward Compatibility**: No
- **v1.2.0 Support**: Until release of next minor version

## v1.1.0 → v1.2.0

### Overview
Expand Down Expand Up @@ -125,6 +208,11 @@ OrangeCompactTheme()

**Reason for Change**: Use more accurate name for the theme

### Compatibility

- **Backward Compatibility**: No
- **v1.1.0 Support**: Until release of next minor version

## v1.0.0 → v1.1.0

### Overview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct ButtonBackgroundModifier: ViewModifier {

func body(content: Content) -> some View {
if let appliedColor {
content.oudsBackground(appliedColor)
content.background(appliedColor)
} else {
content
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ struct ButtonBorderModifier: ViewModifier {
switch appearance {
case .default:
content
.oudsBorder(
.border(
style: theme.borders.styleDefault,
width: defaultWidth,
radius: radius,
color: defaultColor)
case .strong:
if onColoredSurface {
content
.oudsBorder(
.border(
style: theme.borders.styleDefault,
width: defaultWidth,
radius: radius,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import SwiftUI
/// - **normal**: is the normal state of a button which can be disabled, pressed, hovered or normal (i.e. enabled)
/// - **loading**: the style used after button was clicked and probably data are requested before navigate to a next screen or get updated data.
///
struct OUDSButtonStyle: ButtonStyle {
struct StyleForButton: ButtonStyle {

// MARK: Stored Properties

Expand All @@ -45,7 +45,7 @@ struct OUDSButtonStyle: ButtonStyle {

// MARK: Initializer

/// Initialize the `OUDSButtonStyle` for the `appearance`
/// Initialize the `StyleForButton` for the `appearance`
/// and the `style` of the `OUDSButton`.
///
/// - Parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public struct OUDSButton: View {
ButtonTextAndIcon(text: text, icon: icon, flipIcon: flipped)
}
}
.buttonStyle(OUDSButtonStyle(appearance: appearance, style: style, isHover: isHover, isFullWidth: isFullWidth))
.buttonStyle(StyleForButton(appearance: appearance, style: style, isHover: isHover, isFullWidth: isFullWidth))
.disabled(style == .loading)
.accessibilityLabel(accessibilityLabel)
#if !os(watchOS) && !os(tvOS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct UnorderedBullet: View {

var body: some View {
ScaledIcon(icon: image.renderingMode(.template), size: assetSize)
.oudsForegroundColor(color)
.foregroundColor(color)
}

// MARK: Private helpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ struct CheckboxBackgroundColorModifier: ViewModifier {
case .enabled, .disabled, .readOnly:
content
case .hover:
content.oudsBackground(theme.controlItem.colorBgHover)
content.background(theme.controlItem.colorBgHover)
.clipShape(RoundedRectangle(cornerRadius: theme.controlItem.borderRadiusItemOnly))
case .pressed:
content.oudsBackground(theme.controlItem.colorBgPressed)
content.background(theme.controlItem.colorBgPressed)
.clipShape(RoundedRectangle(cornerRadius: theme.controlItem.borderRadiusItemOnly))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct CheckboxIndicator: View {
.renderingMode(.template)
.scaledToFit()
.accessibilityHidden(true)
.oudsForegroundColor(appliedColor)
.foregroundColor(appliedColor)
}

private var appliedColor: MultipleColorSemanticToken {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private struct CheckboxIndicatorForegroundModifier: ViewModifier {

func body(content: Content) -> some View {
content
.oudsForegroundColor(appliedColor)
.foregroundColor(appliedColor)
}

// MARK: - Colors
Expand Down Expand Up @@ -199,10 +199,10 @@ private struct CheckboxIndicatorBorderModifier: ViewModifier {
func body(content: Content) -> some View {
content
.clipShape(RoundedRectangle(cornerRadius: appliedBorderRadius))
.oudsBorder(style: theme.borders.styleDefault,
width: appliedBorderWidth,
radius: appliedBorderRadius,
color: appliedColor)
.border(style: theme.borders.styleDefault,
width: appliedBorderWidth,
radius: appliedBorderRadius,
color: appliedColor)
}

// MARK: - Colors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private struct ChipSelectionIndicator: View {
ScaledIcon(icon: Image(decorative: "ic_chip_tick", bundle: theme.resourcesBundle).renderingMode(.template),
size: theme.chip.sizeIcon)
.accessibilityHidden(true)
.oudsForegroundColor(appliedColor)
.foregroundColor(appliedColor)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct ChipBackgroundModifier: ViewModifier {
// MARK: Body

func body(content: Content) -> some View {
content.oudsBackground(appliedColor)
content.background(appliedColor)
}

// MARK: Private helpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct ChipBorderModifier: ViewModifier {

func body(content: Content) -> some View {
content
.oudsBorder(
.border(
style: theme.borders.styleDefault,
width: width,
radius: theme.chip.borderRadius,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct ChipForegroundModifier: ViewModifier {
// MARK: Body

func body(content: Content) -> some View {
content.oudsForegroundColor(appliedColor)
content.foregroundColor(appliedColor)
}

// MARK: Private helpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ struct RadioBackgroundModifier: ViewModifier {
case .enabled, .disabled, .readOnly:
content
case .hover:
content.oudsBackground(theme.controlItem.colorBgHover)
content.background(theme.controlItem.colorBgHover)
.clipShape(RoundedRectangle(cornerRadius: theme.controlItem.borderRadiusItemOnly))
case .pressed:
content.oudsBackground(theme.controlItem.colorBgPressed)
content.background(theme.controlItem.colorBgPressed)
.clipShape(RoundedRectangle(cornerRadius: theme.controlItem.borderRadiusItemOnly))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private struct RadioIndicatorForegroundModifier: ViewModifier {

func body(content: Content) -> some View {
content
.oudsForegroundColor(appliedColor)
.foregroundColor(appliedColor)
}

// MARK: - Colors
Expand Down Expand Up @@ -185,10 +185,10 @@ private struct RadioIndicatorBorderModifier: ViewModifier {

func body(content: Content) -> some View {
content
.oudsBorder(style: theme.borders.styleDefault,
width: appliedBorderWidth,
radius: appliedBorderRadius,
color: appliedColor)
.border(style: theme.borders.styleDefault,
width: appliedBorderWidth,
radius: appliedBorderRadius,
color: appliedColor)
}

// MARK: - Colors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct SwitchIndicator: View {
Cursor(interactionState: interactionStateComputed, isOn: isOn)
.padding(.horizontal, padding)
.frame(width: trackWidth, height: trackHeight, alignment: cursorHorizontalAlignment)
.oudsBackground(trackColor)
.background(trackColor)
.clipShape(RoundedRectangle(cornerRadius: theme.switch.borderRadiusTrack))
.animation(trackAnimation, value: cursorHorizontalAlignment)
#if os(iOS)
Expand Down Expand Up @@ -140,9 +140,9 @@ private struct Cursor: View {
.opacity(theme.switch.opacityCheck)
}
.frame(width: cursorWidth, height: cursorHeight, alignment: .center)
.oudsBackground(theme.switch.colorCursor)
.background(theme.switch.colorCursor)
.clipShape(RoundedRectangle(cornerRadius: theme.switch.borderRadiusCursor))
.oudsShadow(theme.elevations.raised)
.shadow(theme.elevations.raised)
.animation(cursorWidthAnimation, value: cursorWidth)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct HelperErrorTextContainer: View {
if !text.isEmpty {
Text(text)
.labelDefaultMedium(theme)
.oudsForegroundColor(color)
.foregroundColor(color)
.multilineTextAlignment(.leading)
.padding(.top, theme.textInput.spacePaddingBlockTopHelperText)
.padding(.horizontal, theme.textInput.spacePaddingInlineDefault)
Expand Down
Loading
Loading