| type | ai-agent-guide | |
|---|---|---|
| framework | Accessibility-Statement-Library | |
| language | Swift | |
| ui-framework | SwiftUI | |
| platforms |
|
|
| min-deployment | iOS 15.0 |
This file provides guidance to AI coding agents when working with code in this repository or with Accessibility Statement Library iOS products.
Accessibility Statement Library is a simple library which provides a SwiftUI view to display an accessibility statement for legal reasons. It processes an XML file generated by La va11ydette, another Orange open source product. The aim is to be compliant with local laws and display how much the target app is compliant with accessibility rules like WCAG. Developers use the XML file to define the view, and can define additional HTML file to display more details. This file can be hosted in the app and displayed in a webview, or outside the app displayed in a webview or not in that case. The library is open source under license Aapche 2.0.
- statement: A declaration, a statement, with legal information about the company and scores
- theme: A style to apply to the view (Orange, Sosh, Innovation Cup)
The source code is formatted for Swift 5.7. Configuration of formater is in .swiftformat and linter in .swiftlint.
- SwiftUI is the default UI paradigm - embrace its declarative nature
- Avoid legacy UIKit patterns and unnecessary abstractions
- Focus on simplicity, clarity, and native data flow
- Let SwiftUI handle the complexity - don't fight the framework
- Organize by components, keeps things isolated
- Keep related code together in the same file when appropriate
- Use extensions to organize large files
- Follow Swift naming conventions consistently
IMPORTANT: When editing code, you MUST:
- Format the sources
- Build the project after making changes
- Fix any compilation errors before proceeding
- Run the tests
- Run the linter and fix any warnings and errors
- Write documentation in Swift DocC format for public API
- Use Swift's type system for safety
- Use public modifier only when needed, prefer internal or private
- IMPORTANT: The project supports iOS 26 SDK while maintaining iOS 15 as the minimum deployment target. Use
#availablechecks when adopting iOS 15+ APIs. - IMPORTANT: The project runs for iOS / iPadOS
- If a third party dependency is added or updated, update the Software Bill of Material
- Apply Clean Code, DRY, SOLID and TDD principes
- Add abstraction layers without clear benefit
- Use Combine for simple async operations
- Overcomplicate simple features
- Use UIKit except for some specific API related to accessibility if needed
- Minimum Swift 5.7
- Xcode 26.2 or later
- Minimum deployment: iOS 15.0, iPad0S 15.0
- Apple Developer account for device testing
To build the Swift Package:
swift buildTo run the unit tests on the Swift Package:
swift testTo check for dead code:
brew install periphery
cd scripts
./check-dead-code.shTo format the source code:
brew install swiftformat
cd scripts
./run-format.shTo run the linter:
brew install swiftlint
cd scripts
./run-lint.shTo update the Software Bill of Materials:
brew install syft
brew tap anchore/grype
brew install grype
cd scripts
./update-sbom.sh- Check if sources are formatted
- Run linter, no error must appear
- Run tests, they must all pass
- Check if there is dead coden and leave a comment saying the elements which seem toi be dead / not used
- Build documentation, no error must appear
- Check leaks, no leak must appear
- Check if functions are too long or too complicated, complexity must be low
- Check if the commit has been designed-off (i.e. DCO appplied) by all commits authors
import DeclarationAccessibility
import SwiftUI
struct AccessibilityStatementView: View {
let detailsPageURL: URL
init() {
// Load from app bundle a "accessibilty_detail.html" file
guard let detailsPageURL = Bundle.main.url(forResource: "accessibility_detail", withExtension: "html") else {
fatalError("Unable to find accessibility_detail.html in resources")
}
self.detailsPageURL = detailsPageURL
}
var body: some View {
VStack {
// Supposed to have "accessibility_result" XML file in app bundle
// Here load a local HTML page ("accessibility_detail" HTML file in app bundle), forced to be in webview
StatementView(xmlFileName: "accessibility_result", theme: .orange, localURL: detailsPageURL.absoluteString)
}
}
}or with OUDS library:
import DeclarationAccessibility
import OUDSSwiftUI
import SwiftUI
struct AccessibilityStatementPage: View {
let detailsPageURL: URL
@Environment(\.theme) var theme
init() {
guard let detailsPageURL = Bundle.main.url(forResource: "accessibility_detail", withExtension: "html") else {
OL.fatal("Unable to find accessibility_detail.html in resources")
}
self.detailsPageURL = detailsPageURL
}
var body: some View {
VStack {
StatementView(xmlFile: "accessibility_result", localUrl: detailsPageURL.absoluteString, theme: theme)
}
}
}Import the dedicated library from the Swift Package
import DeclarationAccessibilitySupposing accessibility_result is the XML file generated from La va11ydette, for the orange theme,
use a local HTML file with details about the statement:
StatementView(xmlFile: "accessibility_result", theme: .orange, localUrl: absoluteStringUrlToLocalFile)Supposing accessibility_result is the XML file generated from La va11ydette, for the sosh theme,
use an HTML page with details about the statement outside on the web, displayed in a webview:
StatementView(xmlFile: "accessibility_result", theme: .orange, remoteUrl: "https://a11y-guidelines.orange.com/fr/", useWebView: true)and displayed outside the app in browser:
StatementView(xmlFile: "accessibility_result", theme: .orange, remoteUrl: "https://a11y-guidelines.orange.com/fr/", useWebView: false)
// Or same thing
StatementView(xmlFile: "accessibility_result", theme: .orange, remoteUrl: "https://a11y-guidelines.orange.com/fr/")If you use the OUDS library, it is possible to give an OUDSTheme object to the StatementView
so as to apply on it predefined themes (like instances of OrangeTheme, OrangeBusinessToolsTheme, SoshTheme and WireframeTheme) or any local theme.
For example, with a local file:
StatementView(xmlFile: "accessibility_result", localUrl: absoluteStringUrlToLocalFile, theme: someOudsTheme)Or with an external file:
StatementView(xmlFile: "accessibility_result", remoteUrl: "https://a11y-guidelines.orange.com/fr/", useWebView: true, theme: someOudsTheme)