Skip to content

Commit 9c3e378

Browse files
committed
docs: add in AGENTS.md section about accessibility and ecodesign
Signed-off-by: Pierre-Yves Lapersonne <pierreyves.lapersonne@orange.com>
1 parent 633bd22 commit 9c3e378

File tree

1 file changed

+153
-38
lines changed

1 file changed

+153
-38
lines changed

AGENTS.md

Lines changed: 153 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ min-deployment: iOS 15.0
1111

1212
This file provides guidance to AI coding agents when working with code in this repository or with OUDS iOS products.
1313

14-
## Project Overview
14+
## 1. Project Overview
1515

1616
OUDS means Orange Unified Design System and is the new cohesive and unified design system for Orange Group.
1717
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.
1818
The project is open source under MIT license and hosted on GitHub in Orange-OpenSource organization.
1919
The products support iOS 15, iPadOS 15, macOS 15, visionOS 1, watchOS 11 and tvOS 16.
2020
The products are written in Swift with SwiftUI as UI framework and Swift 6 (format, grammar and concurrency).
2121

22-
## Vocabulary
22+
## 2. Vocabulary
2323

2424
- *tokenator*: an internal tool which uses Figma specifications exported as JSON to convert them and send through pull requests the Swift code for tokens
2525
- *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
3131
- *token provider*: an object in a theme gathering tokens (semantics and components)
3232
- *component*: mainly a SwiftUI view with specific features and layouts like buttons, switch, link etc.
3333

34-
## Code formating
34+
## 3. Code formating
3535

3636
The source code is formatted for Swift 6.2. Configuration of formater is in `.swiftformat` and linter in `.swiftlint`.
3737

38-
## Project structure
38+
## 4. Project structure
3939

40-
### DesignToolbox
40+
### 4.1 DesignToolbox
4141

4242
Contains the sources of the Design System Toolbox app for iOS, iPadOS, macOS and visionOS.
4343

44-
### DesignToolboxUITests
44+
### 4.2 DesignToolboxUITests
4545

4646
Contains the sources of UI tests to run on simulators or devices making tests on components and navigating between pages.
4747

48-
### DesignToolboxSnapshotTests
48+
### 4.3 DesignToolboxSnapshotTests
4949

5050
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.
5151

52-
### DesignToolboxUnitTests
52+
### 4.4 DesignToolboxUnitTests
5353

5454
Contains the sources of some unit tests.
5555

56-
### DesignToolbox (Light)
56+
### 4.5 DesignToolbox (Light)
5757

5858
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.
5959

60-
## Architecture details
60+
## 5. Architecture details
6161

6262
The Design System Toolbox is quite simple and must be usable in iOS, iPadOS, macOS, visionOS and watchOS.
6363

64-
### Pages
64+
### 5.1 Pages
6565

6666
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.
6767

68-
### Utils
68+
### 5.2 Utils
6969

7070
Here are some utilities, extensions and objects to sued everywhere in the app.
7171

72-
### Resources
72+
### 5.3 Resources
7373

7474
Here are assets, images, HTML files like legal notices and fonts.
7575

76-
## Architecture guidelines
76+
## 6. Architecture guidelines
7777

7878
- SwiftUI is the default UI paradigm - embrace its declarative nature
7979
- Avoid legacy UIKit patterns and unnecessary abstractions
@@ -84,7 +84,7 @@ Here are assets, images, HTML files like legal notices and fonts.
8484
- Use extensions to organize large files
8585
- Follow Swift naming conventions consistently
8686

87-
## Build verification process
87+
## 7. Build verification process
8888

8989
**IMPORTANT**: When editing code, you MUST:
9090
1. Format the sources
@@ -93,9 +93,9 @@ Here are assets, images, HTML files like legal notices and fonts.
9393
4. Run the tests
9494
5. Run the linter and fix any warnings and errors
9595

96-
## Best practices
96+
## 8. Best practices
9797

98-
### DO
98+
### 8.1 DO
9999

100100
- Write documentation in Swift DocC format for public API
101101
- Use Swift's type system for safety
@@ -110,23 +110,23 @@ Here are assets, images, HTML files like legal notices and fonts.
110110
- If a third party dependency is added or updated, update the 3rd parties list in the Design System Toolbox
111111
- Apply Clean Code, DRY, SOLID and TDD principes
112112

113-
### DON'T
113+
### 8.1 DON'T
114114

115115
- Add abstraction layers without clear benefit
116116
- Use Combine for simple async operations
117117
- Overcomplicate simple features
118118
- Use UIKit except for some specific API related to accessibility if needed
119119

120-
## Development requirements
120+
## 9. Development requirements
121121

122122
- Minimum Swift 6.2 (e.g. Swigt 6.2.3)
123123
- Xcode 26.2 or later
124124
- Minimum deployment: iOS 15.0, iPad0S 15.0, macOS 15.6, visionOS 1.3, watch0S 11.6, tvOS 16.6
125125
- Apple Developer account for device testing
126126

127-
## Building commands
127+
## 10. Building commands
128128

129-
### Building Design System Toolbox app
129+
### 10.1 Building Design System Toolbox app
130130

131131
To build the Design System Toolbox app for iOS and iPadOS:
132132
```shell
@@ -153,7 +153,7 @@ To build the Design System Toolbox app for tvOS:
153153
bundle exec fastlane tv build_debug
154154
```
155155

156-
### Run tests
156+
### 10.2 Run tests
157157

158158
To run the snapshot tests (only supported for iOS):
159159
```shell
@@ -170,7 +170,7 @@ To run the unit tests (only supported for iOS):
170170
bundle exec fastlane ios test_unit
171171
```
172172

173-
### Check dead code
173+
### 10.3 Check dead code
174174

175175
To check for dead code for iOS and iPadOS:
176176
```shell
@@ -197,55 +197,170 @@ To check for dead code for tvOS:
197197
bundle exec fastlane tv check_dead_code
198198
```
199199

200-
### Format the sources
200+
### 10.4 Format the sources
201201

202202
To format the source code:
203203
```shell
204204
bundle exec fastlane format
205205
```
206206

207-
### Run linter
207+
### 10.5 Run linter
208208

209209
To run the linter:
210210
```shell
211211
bundle exec fastlane lint
212212
```
213213

214-
### Check leaks
214+
### 10.6 heck leaks
215215

216216
To check for leaks of secrets:
217217
```shell
218218
bundle exec fastlane check_leaks
219219
```
220220

221-
### Software Bill Of Materiels update
221+
### 10.7 Software Bill Of Materiels update
222222

223223
To update the Software Bill of Materials:
224224
```shell
225225
bundle exec fastlane update_sbom
226226
```
227227

228-
### 3rd parties list update
228+
### 10.8 3rd parties list update
229229

230230
To update the list of dependencies used in the app:
231231
```shell
232232
bundle exec fastlane update_3rd_parties
233233
```
234234

235-
### Update build number
235+
### 10.9 Update build number
236236

237237
To update the build number of the app:
238238
```shell
239239
bundle exec fastlane update_build_number
240240
```
241241

242-
## Review guidelines
242+
## 11. Review guidelines
243243

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

Comments
 (0)