Skip to content

Commit 98640b4

Browse files
pylappludovic35julien-deramond
authored
Version 0.2.0 (#113)
Released of version 0.2.0 See below the full CHANGELOG details. Added: - [Tests] Add UI regression tests using snapshot comparisons with *swift-snapshot-testing* tool ([#78](#78)) - [DemoApp] Display fake components for elevation rendering tests - [Library] A theme can now override the custom font family - [Tests] Add more unit tests for theme overriding and raw tokens controls - [Library] Add and update raw and semantic grid tokens ([#40](#40)) - [Library] Manage regular and compact layouts for sizing and spacing tokens - [Library] "Box shadow 0" has been defined and "elevation drag" changed - [Doc] Create the basics of a documentation ([#9](#9)) - [Library] Add more semanttic and raw tokens for typography - [Library] Add more semantic and raw tokens for typography, and SwiftUI API to apply them - [Library] Computation of SwiftUI radius from Figma blur and spread values for elevation tokens - [Library] Add elevation tokens ([#32](#32)) Changed: - [Library] Split raws, semantics and components tokens definitions and also values, composites and type aliases - [Showcase] Improve Fastlane alpha build notifications - [Library] Do not store blur value in elevation semantic tokens - [Library] Change type aliases for X and Y offsets of elevations tokens - [Library] Update border semantic tokens values ([#106](#106)) - [Showcase] Add fake components for demo and tokens tests - [Library] Remove spread value for elevation tokens - [Library] Remove paragraph spacing tokens for typography - [Library] Term "fluid" has been replaced by "adaptable" in spacing semantic tokens - [Doc] Improve DocC documentation about tokens and views extensions - [Doc] Add more details in release documentation - [Library] Rename semantic token "opacityEmphasized" to "opacityStrong" ([#94](#94)) - [Library] Update value of opacity raw token "opacity800" from 0.88 to 0.80 ([#87](#87)) - [Tests] Add missing unit tests for opacity raw tokens - [Library] "OUDSThemesCommons" product has been renamed to "OUDS" Removed: - [Library] Remove Z Index tokens for elevations ([#109](#109)) - [Library] Remove token "borderRadiusPill" and "borderRadiusCircle" ([#58](#58)) - [Library] "Emphasis" words have been replaced by "emphasized" - [Library] "Box shadow" words have been removed in elevation semantic and raw tokens Fixed: - [Library] Fix some typos in documentation ([#89](#89)) Acked-by: Ludovic Pinel <[email protected]> Co-authored-by: Ludovic Pinel <[email protected]> Co-authored-by: Pierre-Yves Lapersonne <[email protected]> Co-authored-by: Julien Déramond <[email protected]>
2 parents a6b6d89 + 6a77099 commit 98640b4

File tree

171 files changed

+6361
-3038
lines changed

Some content is hidden

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

171 files changed

+6361
-3038
lines changed

.github/DEVELOP.md

+58-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
- [Technical preconditions](#technical-preconditions)
44
- [Build showcase demo app](#build-showcase-demo-app)
55
- [Documentation](#documentation)
6+
- [Run tests](#run-tests)
7+
* [Unit tests for OUDS Swift package](#unit-tests-for-ouds-swift-package)
8+
* [UI tests in demo app](#ui-tests-in-demo-app)
69
- [Build phases](#build-phases)
710
- [Targets](#targets)
811
- [Certificates, profiles and identifiers](#certificates-profiles-and-identifiers)
@@ -20,12 +23,12 @@
2023
You should check wether or not you have the tools in use in the project like _Fastlane_, _SwiftLint_, _SwiftFormat_, etc.
2124
You can have a look for example in thr **THIRD\_PARTY.md** file which lists any dependencies and tools we use are different levels (SDK, showcase app, projects).
2225

23-
If some tools are missing, pick the suitable command line bellow:
26+
If some tools are missing, pick the suitable command line below:
2427
```bash
2528
# Use Bundler to install a major part of dependencies (thanks to Gemfile and Gemfile.lock files)
2629
bundle install
2730

28-
# Use CocoaPods to install other dependencies not avaialble as rubygems (thanks to Podfile and Podfile.lock files)
31+
# Use CocoaPods to install other dependencies not available as rubygems (thanks to Podfile and Podfile.lock files)
2932
bundle exec pod install
3033

3134
# Some dependencies must be downloaded by hand:
@@ -49,7 +52,53 @@ To build the demo application follow those steps:
4952

5053
## Documentation
5154

52-
_To be defined soon_
55+
The documentation is based on the Swift documentation with [DocC](https://www.swift.org/documentation/docc/).
56+
We use here the [swift-docc-plugin](https://github.com/swiftlang/swift-docc-plugin) to build the HTML documentations using the documentation catalogs
57+
and any _DocC_ comments in the source code.
58+
59+
The documentation can be built from Xcode with _Product > Build Documentation_.
60+
61+
The `generateDoc.sh` script helps to build the HTML version of documentation and compress it in ZIP file, and also can update
62+
the online version based on [_GitHub Pages_](https://pages.github.com/), this version is hosted in the [*gh-pages* GitHub branch](https://github.com/Orange-OpenSource/ouds-ios/tree/gh-pages).
63+
64+
## Run tests
65+
66+
### Unit tests for OUDS Swift package
67+
68+
To run these unit tests follow some steps:
69+
70+
1. `cd Showcase`
71+
2. `bundle exec pod install`
72+
3. Open *Showcase.xcworkspace*
73+
4. Select *Showcase* scheme
74+
5. Run tests (Product -> Test)
75+
76+
Unit tests care have been implemented for several reasons.
77+
78+
First, we don't have too much control on the raw tokens values. We rely on the _Figma_ design tool which outputs the tokens in a JSON file.
79+
And this file will be parsed to as to generate Swift files. But if there are inconsistencies in the _Figma_ side or in the parser side, the inconsistencies will be spread in our code base.
80+
It is not useful to define unit tests for raw tokens to test their values ; in fact they exist here to be updated.
81+
But we wan still check other things like the relationship between them. For example a _grid100_ should always be less or equal than a _grid100_. Some _color100_ should be always lighter than a _color200_, etc, etc. A small typo should be always smaller or with the sale size has a one-step-bigger typo.
82+
83+
Then, we want to know when tokens have been removed so as to warn our users and keep release notes and changelog clean. If we don't spot such changes, maybe some users will be impacted.
84+
85+
Finally, we ensure our themes can override any semantic tokens. Themes are in fact a set of values for the whole universe of semantic tokens, and if a theme cannot override a semantic token, there could be an issue. Unit tests also help us to find if some tokens have been removed before releasing the library.
86+
87+
### UI tests in demo app
88+
89+
To run these UI tests follow some steps:
90+
91+
1. `cd Showcase`
92+
2. `bundle exec pod install`
93+
3. Open *Showcase.xcworkspace*
94+
4. Select *ShowcaseTests* scheme
95+
5. Select some simulator (tests designed for *iPhone 13 Pro Max* and *iPhone 14 Pro Max* but works elsewhere)
96+
6. Run tests (Product -> Test)
97+
98+
Beware, if you add new UI tests using [swift-snapshot-testing](https://github.com/pointfreeco/swift-snapshot-testing) library, you may have new tests which fail at first time.
99+
Indeed for new tests the tool makes snapshots of the views, thus for the first run no preview exist making the tests fail. You should run the tests twice for new tests.
100+
101+
Such tests here are used to as to be sure the look and feel of any components and tokens rendering remaing the expected ones.
53102

54103
## Build phases
55104

@@ -65,11 +114,12 @@ The Xcode project contains two targets:
65114

66115
1. _Showcase_ for the demo application
67116
2. _Periphery_ to look for dead code in the source code
117+
3. _ShowcaseTests_ for UI tests in demo app
68118

69119
## Certificates, profiles and identifiers
70120

71121
We choose to use Xcode automatic signing for debug builds of the app so as to make easier onboarding of newcomers in development team, and also to prevent to update provisioning profiles with individual developers certificates each team someone wants to build the app and also to prevent to register each new build device). You may need to be part of our team if you want to build in debug mode.
72-
Note the bundle identifier here for lcoal builds is **com.orange.ouds.demoapp-debug**, with a **-debug** suffix so as to prevent any local build to be replaced by TestFlight builds which have **com.orange.ouds.demoapp** identifiers.
122+
Note the bundle identifier here for local builds is **com.orange.ouds.demoapp-debug**, with a **-debug** suffix so as to prevent any local build to be replaced by TestFlight builds which have **com.orange.ouds.demoapp** identifiers.
73123

74124
However for release builds we use a dedicated _provisioning profile_ built with of course a _distribution certificate_(.p12 format with private key, not .cer) and the _bundle identifier_ `com.orange.ouds.demoapp` for our _Apple Team_ `France Telecom (MG2LSJNJB6)`. Thus you won't be able to build and sign in release mode without this provisioning profile and this distribution certificate. These elements are stored in our local GitLab CI runners and must not be available outside.
75125

@@ -166,7 +216,7 @@ exit 0
166216
We try also to apply [keep a changelog](https://keepachangelog.com/en/1.0.0/), and [semantic versioning](https://semver.org/spec/v2.0.0.html) both with [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).
167217

168218
You can generate a `RELEASE_NOTE.md` file using your Git history and [git cliff](https://git-cliff.org/) tool.
169-
Define first a `cliff.toml` configuration file containing the code bellow.
219+
Define first a `cliff.toml` configuration file containing the code below.
170220

171221
```toml
172222
# git-cliff ~ configuration file
@@ -176,7 +226,7 @@ Define first a `cliff.toml` configuration file containing the code bellow.
176226
# changelog header
177227
header = """
178228
# Release Note\n
179-
All notable changes for this version are here and blablbla.\n
229+
All notable changes for this version are here and blablabla.\n
180230
"""
181231
# template for the changelog body
182232
# https://keats.github.io/tera/docs/#introduction
@@ -353,9 +403,9 @@ sort_commits = "oldest"
353403
A [GitHub Action](https://github.com/gitleaks/gitleaks-action) has been integrated to the repository with a configuration file defined in _/github/workflows_ named _gitleaks-action.yaml_.
354404
It will launch the _Gitleaks_ tool automatically.
355405

356-
Howevere this tool does not detect plain API key mixed in URL, that is a reason why _Gitleaks_ can be called in a pre-commit hook, using the _giteaks.toml_ at the root of the prokect.
406+
However this tool does not detect plain API key mixed in URL, that is a reason why _Gitleaks_ can be called in a pre-commit hook, using the _giteaks.toml_ at the root of the project.
357407
To call _Gitleaks_ in pre-commit hooks, create a file named **pre-commit** inside _.git/hooks_ (then run `chmod u+x` in the file).
358-
Then place the bash code bellow in this file:
408+
Then place the bash code below in this file:
359409

360410
```bash
361411
# Run Gitleaks before commits

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
/Showcase/Showcase.xcworkspace/xcuserdata/
2828
/DerivedData/
2929

30+
# Produced by generateDoc.sh
31+
.build
32+
3033
# Produced by Swift Package Manager
3134
/.swiftpm/xcode/xcshareddata/
3235
/.swiftpm/xcode/xcuserdata/

CHANGELOG.md

+56-11
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,73 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.2.0](https://github.com/Orange-OpenSource/ouds-ios/compare/0.1.0...0.2.0) - 2024-09-19
8+
9+
### Added
10+
11+
- [Tests] Add UI regression tests using snapshot comparisons with *swift-snapshot-testing* tool ([#78](https://github.com/Orange-OpenSource/ouds-ios/issues/78))
12+
- [DemoApp] Display fake components for elevation rendering tests
13+
- [Library] A theme can now override the custom font family
14+
- [Tests] Add more unit tests for theme overriding and raw tokens controls
15+
- [Library] Add and update raw and semantic grid tokens ([#40](https://github.com/Orange-OpenSource/ouds-ios/issues/40))
16+
- [Library] Manage regular and compact layouts for sizing and spacing tokens
17+
- [Library] "Box shadow 0" has been defined and "elevation drag" changed
18+
- [Doc] Create the basics of a documentation ([#9](https://github.com/Orange-OpenSource/ouds-ios/issues/9))
19+
- [Library] Add more semanttic and raw tokens for typography
20+
- [Library] Add more semantic and raw tokens for typography, and SwiftUI API to apply them
21+
- [Library] Computation of SwiftUI radius from Figma blur and spread values for elevation tokens
22+
- [Library] Add elevation tokens ([#32](https://github.com/Orange-OpenSource/ouds-ios/issues/32))
23+
24+
### Changed
25+
26+
- [Library] Split raws, semantics and components tokens definitions and also values, composites and type aliases
27+
- [Showcase] Improve Fastlane alpha build notifications
28+
- [Library] Do not store blur value in elevation semantic tokens
29+
- [Library] Change type aliases for X and Y offsets of elevations tokens
30+
- [Library] Update border semantic tokens values ([#106](https://github.com/Orange-OpenSource/ouds-ios/issues/106))
31+
- [Showcase] Add fake components for demo and tokens tests
32+
- [Library] Remove spread value for elevation tokens
33+
- [Library] Remove paragraph spacing tokens for typography
34+
- [Library] Term "fluid" has been replaced by "adaptable" in spacing semantic tokens
35+
- [Doc] Improve DocC documentation about tokens and views extensions
36+
- [Doc] Add more details in release documentation
37+
- [Library] Rename semantic token "opacityEmphasized" to "opacityStrong" ([#94](https://github.com/Orange-OpenSource/ouds-ios/issues/94))
38+
- [Library] Update value of opacity raw token "opacity800" from 0.88 to 0.80 ([#87](https://github.com/Orange-OpenSource/ouds-ios/issues/87))
39+
- [Tests] Add missing unit tests for opacity raw tokens
40+
- [Library] "OUDSThemesCommons" product has been renamed to "OUDS"
41+
42+
### Removed
43+
44+
- [Library] Remove Z Index tokens for elevations ([#109](https://github.com/Orange-OpenSource/ouds-ios/issues/109))
45+
- [Library] Remove token "borderRadiusPill" and "borderRadiusCircle" ([#58](https://github.com/Orange-OpenSource/ouds-ios/issues/58))
46+
- [Library] "Emphasis" words have been replaced by "emphasized"
47+
- [Library] "Box shadow" words have been removed in elevation semantic and raw tokens
48+
49+
### Fixed
50+
51+
- [Library] Fix some typos in documentation ([#89](https://github.com/Orange-OpenSource/ouds-ios/issues/89))
52+
753
## [0.1.0](https://github.com/Orange-OpenSource/ouds-ios/compare/0.0.0...0.1.0) - 2024-08-08
854

955
### Added
1056

1157
- [Library] Add simple logger for console outputs
12-
- [Library] Add unit tests for Sosh brand colors raw tokens
13-
- [Library] Add unit tests for Orange brand colors raw tokens
14-
- [Library] Add unit tests for foundations
15-
- [Library] Add unit tests for raw tokens and semantic tokens for colors
58+
- [Tests] Add unit tests for Sosh brand colors raw tokens
59+
- [Tests] Add unit tests for Orange brand colors raw tokens
60+
- [Tests] Add unit tests for foundations
61+
- [Tests] Add unit tests for raw tokens and semantic tokens for colors
1662
- [Library] Add draft of raw tokens and semantic tokens for grids
1763

1864
### Changed
1965

2066
- [Library] Redefine Swift Package with clearer path for sources, tests cases and test plan
2167
- [Library] Expose product "OUDSThemesCommons" instead of "OUDSThemesShared"
22-
- [Library] Improve unit tests for elevation semantic tokens
23-
- [Library] Improve unit tests for typography raw tokens
24-
- [Library] Improve unit tests for opacity raw tokens
25-
- [Library] Improve unit tests for elevations raw tokens
26-
- [Library] Improve unit tests for dimensions raw tokens
27-
- [Library] Improve unit tests for borders raw tokens
68+
- [Tests] Improve unit tests for elevation semantic tokens
69+
- [Tests] Improve unit tests for typography raw tokens
70+
- [Tests] Improve unit tests for opacity raw tokens
71+
- [Tests] Improve unit tests for elevations raw tokens
72+
- [Tests] Improve unit tests for dimensions raw tokens
73+
- [Tests] Improve unit tests for borders raw tokens
2874

2975
### Fixed
3076

@@ -43,7 +89,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4389
- [Library] Add raw tokens and semantic tokens for border ([#30](https://github.com/Orange-OpenSource/ouds-ios/issues/30))
4490
- [Library] Define Swift Package architecture of library and tokens (raw and semantic) ([#33](https://github.com/Orange-OpenSource/ouds-ios/issues/33))
4591
- [Library] Define Swift Package library for OUDS ([#46](https://github.com/Orange-OpenSource/ouds-ios/issues/46))
46-
4792
- [Showcase] Publication of comment on issues about new alpha build upload on TestFlight ([#56](https://github.com/Orange-OpenSource/ouds-ios/issues/56))
4893
- [Showcase] Distribute demo app development version ([#12](https://github.com/Orange-OpenSource/ouds-ios/issues/12))
4994
- [Showcase] Distribute demo app for feature validation ([#13](https://github.com/Orange-OpenSource/ouds-ios/issues/13))

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,4 +322,4 @@ DEPENDENCIES
322322
xcode-install (= 2.8.1)
323323

324324
BUNDLED WITH
325-
2.5.11
325+
2.5.17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
//
2+
// Software Name: OUDS iOS
3+
// SPDX-FileCopyrightText: Copyright (c) Orange SA
4+
// SPDX-License-Identifier: MIT
5+
//
6+
// This software is distributed under the MIT license,
7+
// the text of which is available at https://opensource.org/license/MIT/
8+
// or see the "LICENSE" file for more details.
9+
//
10+
// Authors: See CONTRIBUTORS.txt
11+
// Software description: A SwiftUI components library with code examples for Orange Unified Design System
12+
//
13+
14+
import Foundation
15+
import OUDSFoundations
16+
import OUDSTokensSemantic
17+
import SwiftUI
18+
19+
/// An OUDS component for buttons.
20+
/// __Warning: This is a draft component__.
21+
///
22+
/// This component is created to illustrate the mecanism of theme and tokens and for tests.
23+
public struct OUDSButton: View {
24+
25+
// MARK: - Properties
26+
27+
/// The text to display inside the button
28+
private let text: String
29+
30+
/// The action to process when the button is activated by a user interaction like a tap
31+
private let action: () -> Void
32+
33+
/// To get tokens to customize the component
34+
@Environment(\.theme) private var theme
35+
36+
/// To choose if ight or dark color must be used
37+
@Environment(\.colorScheme) private var colorScheme
38+
39+
/// To get programatically and on the fly the horizontal layout size
40+
@Environment(\.horizontalSizeClass) private var sizeClass
41+
42+
// MARK: - Init
43+
44+
/// Initializes the button.
45+
///
46+
/// - Parameters:
47+
/// - text: Text displayed in the button.
48+
/// - action: Will be called when the user clicks the button.
49+
public init(text: String, action: @escaping () -> Void) {
50+
self.text = text
51+
self.action = action
52+
}
53+
54+
// MARK: - Body
55+
56+
public var body: some View {
57+
Button {
58+
action()
59+
} label: {
60+
Text(text)
61+
.systemFont(typography: theme.buttonTypography)
62+
.padding(theme.buttonInternalSpacing)
63+
.foregroundColor(colorScheme == .light
64+
? theme.buttonForegroundColorLight.color
65+
: theme.buttonForegroundColorDark.color)
66+
.modifier(BorderStyleModifier(theme.buttonBorderStyle,
67+
theme.buttonBorderWidth,
68+
theme.buttonBorderRadius,
69+
theme.buttonBorderColorLight,
70+
theme.buttonBorderColorDark))
71+
}.frame(width: theme.buttonWidth, height: theme.buttonHeight)
72+
}
73+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// Software Name: OUDS iOS
3+
// SPDX-FileCopyrightText: Copyright (c) Orange SA
4+
// SPDX-License-Identifier: MIT
5+
//
6+
// This software is distributed under the MIT license,
7+
// the text of which is available at https://opensource.org/license/MIT/
8+
// or see the "LICENSE" file for more details.
9+
//
10+
// Authors: See CONTRIBUTORS.txt
11+
// Software description: A SwiftUI components library with code examples for Orange Unified Design System
12+
//
13+
14+
import Foundation
15+
import OUDSTokensSemantic
16+
import SwiftUI
17+
18+
extension View {
19+
20+
/// Applies a `CustomFontModifier` on the current `View` so as to add a specific `Font`.
21+
/// - Parameters:
22+
/// - familyName: The font family name to load later (e.g. "Luciole")
23+
/// - token: The typography token to use to get useful values for `compact` or `regular` mode
24+
/// - Returns: The `View` with the custom font applied
25+
func customFont(familyName: String, typography token: TypographyCompositeSemanticToken) -> some View {
26+
self.modifier(CustomFontModifier(token: token, fontFamilyName: familyName))
27+
}
28+
29+
/// Applies a `FontModifier` to use the system font on the current `View` with a specific token
30+
/// - Parameter token: The typography token to use to get useful values for `compact` or `regular` mode
31+
/// - Returns: The `View` with the custom font applied
32+
func systemFont(typography token: TypographyCompositeSemanticToken) -> some View {
33+
self.modifier(FontModifier(token: token))
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//
2+
// Software Name: OUDS iOS
3+
// SPDX-FileCopyrightText: Copyright (c) Orange SA
4+
// SPDX-License-Identifier: MIT
5+
//
6+
// This software is distributed under the MIT license,
7+
// the text of which is available at https://opensource.org/license/MIT/
8+
// or see the "LICENSE" file for more details.
9+
//
10+
// Authors: See CONTRIBUTORS.txt
11+
// Software description: A SwiftUI components library with code examples for Orange Unified Design System
12+
//
13+
14+
import Foundation
15+
import OUDSTokensSemantic
16+
import SwiftUI
17+
18+
extension View {
19+
20+
/// Wraps the *SwiftUI* `shadow(color:radius:x:y)` method so as to use as `radius` value
21+
/// the computed `radius` value of the given `ElevationCompositeSemanticToken`.
22+
/// - Parameter elevation: The token to give for the shadow / elevation effect
23+
/// - Returns `View`: The current `View` with the shadow / elevation effect
24+
public func shadow(elevation: ElevationCompositeSemanticToken) -> some View {
25+
return self
26+
.shadow(color: elevation.color.color,
27+
radius: elevation.radius,
28+
x: CGFloat(elevation.x),
29+
y: CGFloat(elevation.y))
30+
}
31+
}

0 commit comments

Comments
 (0)