You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file provides guidance to AI coding agents when working with code in this repository or with OUDS iOS products.
13
13
14
-
## Project Overview
14
+
## 1. Project Overview
15
15
16
16
OUDS means Orange Unified Design System and is the new cohesive and unified design system for Orange Group.
17
17
It provides a Swift Package and a demo application (this repository) called Design System Tooblox which embeds the Swift Package to expose its public API.
18
18
The project is open source under MIT license and hosted on GitHub in Orange-OpenSource organization.
19
19
The products support iOS 15, iPadOS 15, macOS 15, visionOS 1, watchOS 11 and tvOS 16.
20
20
The products are written in Swift with SwiftUI as UI framework and Swift 6 (format, grammar and concurrency).
21
21
22
-
## Vocabulary
22
+
## 2. Vocabulary
23
23
24
24
-*tokenator*: an internal tool which uses Figma specifications exported as JSON to convert them and send through pull requests the Swift code for tokens
25
25
-*token*: variable containing a value in most of cases defined by *tokenator*
@@ -31,49 +31,49 @@ The products are written in Swift with SwiftUI as UI framework and Swift 6 (form
31
31
-*token provider*: an object in a theme gathering tokens (semantics and components)
32
32
-*component*: mainly a SwiftUI view with specific features and layouts like buttons, switch, link etc.
33
33
34
-
## Code formating
34
+
## 3. Code formating
35
35
36
36
The source code is formatted for Swift 6.2. Configuration of formater is in `.swiftformat` and linter in `.swiftlint`.
37
37
38
-
## Project structure
38
+
## 4. Project structure
39
39
40
-
### DesignToolbox
40
+
### 4.1 DesignToolbox
41
41
42
42
Contains the sources of the Design System Toolbox app for iOS, iPadOS, macOS and visionOS.
43
43
44
-
### DesignToolboxUITests
44
+
### 4.2 DesignToolboxUITests
45
45
46
46
Contains the sources of UI tests to run on simulators or devices making tests on components and navigating between pages.
47
47
48
-
### DesignToolboxSnapshotTests
48
+
### 4.3 DesignToolboxSnapshotTests
49
49
50
50
Contains the sources of snapshots tests, i.e. unit tests where there are comparisons of the tokens and components looks and feels using screen rendering.
51
51
52
-
### DesignToolboxUnitTests
52
+
### 4.4 DesignToolboxUnitTests
53
53
54
54
Contains the sources of some unit tests.
55
55
56
-
### DesignToolbox (Light)
56
+
### 4.5 DesignToolbox (Light)
57
57
58
58
Contains source code of the design toolbox app but only for watchOS and tvOS as a light version with few configurations possibilities and more catalogs of components displayed in one time.
59
59
60
-
## Architecture details
60
+
## 5. Architecture details
61
61
62
62
The Design System Toolbox is quite simple and must be usable in iOS, iPadOS, macOS, visionOS and watchOS.
63
63
64
-
### Pages
64
+
### 5.1 Pages
65
65
66
66
Here are the "views" of the app displaying the tokens and components, gathered by components and tokens, and with folder in higher level depending to navigation.
67
67
68
-
### Utils
68
+
### 5.2 Utils
69
69
70
70
Here are some utilities, extensions and objects to sued everywhere in the app.
71
71
72
-
### Resources
72
+
### 5.3 Resources
73
73
74
74
Here are assets, images, HTML files like legal notices and fonts.
75
75
76
-
## Architecture guidelines
76
+
## 6. Architecture guidelines
77
77
78
78
- SwiftUI is the default UI paradigm - embrace its declarative nature
79
79
- Avoid legacy UIKit patterns and unnecessary abstractions
@@ -84,7 +84,7 @@ Here are assets, images, HTML files like legal notices and fonts.
84
84
- Use extensions to organize large files
85
85
- Follow Swift naming conventions consistently
86
86
87
-
## Build verification process
87
+
## 7. Build verification process
88
88
89
89
**IMPORTANT**: When editing code, you MUST:
90
90
1. Format the sources
@@ -93,9 +93,9 @@ Here are assets, images, HTML files like legal notices and fonts.
93
93
4. Run the tests
94
94
5. Run the linter and fix any warnings and errors
95
95
96
-
## Best practices
96
+
## 8. Best practices
97
97
98
-
### DO
98
+
### 8.1 DO
99
99
100
100
- Write documentation in Swift DocC format for public API
101
101
- Use Swift's type system for safety
@@ -110,23 +110,23 @@ Here are assets, images, HTML files like legal notices and fonts.
110
110
- If a third party dependency is added or updated, update the 3rd parties list in the Design System Toolbox
111
111
- Apply Clean Code, DRY, SOLID and TDD principes
112
112
113
-
### DON'T
113
+
### 8.1 DON'T
114
114
115
115
- Add abstraction layers without clear benefit
116
116
- Use Combine for simple async operations
117
117
- Overcomplicate simple features
118
118
- Use UIKit except for some specific API related to accessibility if needed
To build the Design System Toolbox app for iOS and iPadOS:
132
132
```shell
@@ -153,7 +153,7 @@ To build the Design System Toolbox app for tvOS:
153
153
bundle exec fastlane tv build_debug
154
154
```
155
155
156
-
### Run tests
156
+
### 10.2 Run tests
157
157
158
158
To run the snapshot tests (only supported for iOS):
159
159
```shell
@@ -170,7 +170,7 @@ To run the unit tests (only supported for iOS):
170
170
bundle exec fastlane ios test_unit
171
171
```
172
172
173
-
### Check dead code
173
+
### 10.3 Check dead code
174
174
175
175
To check for dead code for iOS and iPadOS:
176
176
```shell
@@ -197,55 +197,170 @@ To check for dead code for tvOS:
197
197
bundle exec fastlane tv check_dead_code
198
198
```
199
199
200
-
### Format the sources
200
+
### 10.4 Format the sources
201
201
202
202
To format the source code:
203
203
```shell
204
204
bundle exec fastlane format
205
205
```
206
206
207
-
### Run linter
207
+
### 10.5 Run linter
208
208
209
209
To run the linter:
210
210
```shell
211
211
bundle exec fastlane lint
212
212
```
213
213
214
-
### Check leaks
214
+
### 10.6 heck leaks
215
215
216
216
To check for leaks of secrets:
217
217
```shell
218
218
bundle exec fastlane check_leaks
219
219
```
220
220
221
-
### Software Bill Of Materiels update
221
+
### 10.7 Software Bill Of Materiels update
222
222
223
223
To update the Software Bill of Materials:
224
224
```shell
225
225
bundle exec fastlane update_sbom
226
226
```
227
227
228
-
### 3rd parties list update
228
+
### 10.8 3rd parties list update
229
229
230
230
To update the list of dependencies used in the app:
231
231
```shell
232
232
bundle exec fastlane update_3rd_parties
233
233
```
234
234
235
-
### Update build number
235
+
### 10.9 Update build number
236
236
237
237
To update the build number of the app:
238
238
```shell
239
239
bundle exec fastlane update_build_number
240
240
```
241
241
242
-
## Review guidelines
242
+
## 11. Review guidelines
243
243
244
-
- Check if sources are formatted
245
-
- Run linter, no error must appear
246
-
- Run tests, they must all pass
247
-
- Check if there is dead coden and leave a comment saying the elements which seem toi be dead / not used
248
-
- Build documentation, no error must appear
249
-
- Check leaks, no leak must appear
250
-
- Check if functions are too long or too complicated, must be low
251
-
- Check if the commit has been designed-off (i.e. DCO appplied) by all commits authors
244
+
-[ ] Check if sources are formatted
245
+
-[ ] Run linter, no error must appear
246
+
-[ ] Run tests, they must all pass
247
+
-[ ] Check if there is dead coden and leave a comment saying the elements which seem toi be dead / not used
248
+
-[ ] Build documentation, no error must appear
249
+
-[ ] Check leaks, no leak must appear
250
+
-[ ] Check if functions are too long or too complicated, must be low
251
+
-[ ] Check if the commit has been designed-off (i.e. DCO appplied) by all commits authors
252
+
253
+
## 12. Ecodesign basics 🟡 RECOMMENDED
254
+
255
+
### 12.1 Animations
256
+
257
+
- Use native / system animations if animations must be used
258
+
259
+
### 12.2 Bad patterns
260
+
261
+
- Prefer pull to refresh instead of inifinite scroll
262
+
- Avoid autocompletion if iot makes network requests
263
+
264
+
### 12.3 Cache
265
+
266
+
- For heavy objects or costly objects to compute (data from networks, date formatters, etc.), use cache like `NSCache`
267
+
- For HTTP requests, use also HTTP cache
268
+
269
+
### 12.4 CPU
270
+
271
+
- Distribute tasks across different threads to free the CPU up as soon as possible
272
+
- Don't use the CPU unnecessarily
273
+
- Use app lifecycle to stop background tasks
274
+
275
+
### 12.5 Downlaods
276
+
277
+
- Avoid automatic download
278
+
- Prefer download on Wifi networks
279
+
280
+
### 12.6 Energy
281
+
282
+
- Never ignore low energy mode
283
+
- If this mode is enabled, disable animations, instensive tasks, display of images and videos, cellular connections, HD / 4K (and above) features, use low colors instead of high (overall on Android with AMOLED screens)
284
+
- Avoid forcing the brightness to maximum
285
+
286
+
### 12.7 Fonts
287
+
288
+
- Prefer system fonts if possible, but in OUDS context use still the view modifiers and provided typography
289
+
- use WOFF2 otherwise
290
+
291
+
### 12.8 Network connections
292
+
293
+
- Prefer wired and Wi-Fi connections to cellular connections
294
+
- If using a cellular connection, group requests as much as possible to avoid the device constantly being connected to the cell tower
295
+
- Use data caching and Gzip compression
296
+
- Avoid periodic polling to prevent rapid battery drain
297
+
- Avoid maintaining connections; services like Apple Push Notifications and Firebase Cloud Messaging can help
298
+
299
+
### 12.9 Notifications
300
+
301
+
- Reduce as much as possible use of notifications
302
+
303
+
### 12.10 OS support
304
+
305
+
- Support iOS 15
306
+
307
+
### 12.11 Resources
308
+
309
+
- Use SGV images, otherwise use SF Symbols
310
+
- Prefer MP3 for sounds
311
+
- Prefer lazy loading of resources
312
+
- Prefer low resolutions for videos
313
+
314
+
### 12.12 Screens
315
+
316
+
- Manage at least small screen like the iPhone SE 2026 one (i.e. 4 inch)
317
+
318
+
### 12.13 UI
319
+
320
+
- With dark mode implementation, use true dark colors (e.g. #00000000)
321
+
322
+
### 12.14 Web views
323
+
324
+
- Avoid use of web views
325
+
326
+
## 13. Accessibility basics 🔴 MANDATORY
327
+
328
+
Everything is available on [our guidelines](https://a11y-guidelines.orange.com/fr/mobile/ios/developpement)
329
+
330
+
### 13.1 Colors and texts
331
+
332
+
- For dark mode, reduce contrasts to avoid halo effects
333
+
- Prefer WCAG AAA 7:1 ratio for normal text (ratio between text and backgrounds)
334
+
- Prefer WCAG AAA 4.5:1 ratio for larhe text (ratio between text and backgrounds)
335
+
- Otherwise apply WCAG AA 4.5:1 for normal text and 3:1 on large text (more than 24 px or 19 px if bold)
336
+
337
+
### 13.2 Components
338
+
339
+
- Do not forge to define accessibility hint, label, value and if needed trait
340
+
341
+
### 13.3 Dates and figures
342
+
343
+
- For texts or figures, define the suitable accessibility value with formatter (like `DateFormatter`) to fully vocalize content for the user with its locale
344
+
345
+
### 13.4 Dipslay
346
+
347
+
- Do not force app in portrait mode
348
+
- APp must be usable in landscape mode
349
+
350
+
### 13.5 Haptics
351
+
352
+
- Use haptics / vibrations when data are loaded, error occured elements have been tapped / activated, etc
353
+
354
+
### 13.6 Medias
355
+
356
+
- Avoid autoplay of videos
357
+
- Define accessibilty labels for images if they are not decorative, otherwise hide them from Voice Over
358
+
359
+
### 13.7 User settings
360
+
361
+
- If accessibilty settings reduce animations, reduce animations
362
+
- If accessibilty settings reduce haptics, reduce haptics
363
+
364
+
### 13.8 Texts
365
+
366
+
- Texts must not have frozen size, they must adapt following the dynamic type
0 commit comments