SwiftUI WCAG Accessibility Auditor
Overview
Audit native iOS SwiftUI features in a dual mode:
- WCAG-driven coverage and evidence — what fails, what is uncertain, and why, mapped to WCAG 2.2 Success Criteria.
- SwiftUI patch-ready remediation — what to change with minimal code edits.
Treat this as a code audit. Do not run the app. If a result cannot be proven from source, mark it Needs user verification and add a concrete user follow-up check.
Scope Rules
- Audit native iOS SwiftUI code only.
- Audit
UIViewRepresentable / UIViewControllerRepresentable bridges only to the extent they affect the SwiftUI feature.
- If the feature delegates core behavior to UIKit, say so and either narrow the audit or recommend
mobile-accessibility-audit.
- Do not broaden scope to macOS, watchOS, web, or non-SwiftUI implementations.
Compatibility Target
- Standards: WCAG 2.2 Level A and AA.
- Devices: iOS, iPadOS, tvOS.
When to Use
Use this skill when you need both:
- WCAG 2.2 mapping / traceability, and
- SwiftUI-specific fixes/snippets.
Trigger keywords: accessibility audit, WCAG, VoiceOver, SwiftUI a11y, contrast, focus state, tap target, Dynamic Type, accessible authentication.
Route elsewhere when:
mobile-accessibility-audit — feature includes UIKit or you only need standards-first audit coverage.
swiftui-accessibility-auditor — you want a fast SwiftUI-only heuristic review without WCAG traceability.
Prerequisites
- SwiftUI source files available in the workspace (
.swift).
ripgrep (rg) available on the host for search guidance.
- WCAG 2.2 and Apple SwiftUI accessibility docs reachable (see Source Anchors).
Audit load order
Follow this order using this SKILL.md plus the Source Anchors — this folder does not ship extra reference files:
- Workflow — Overview (Scope Rules, Compatibility Target) and Procedure. Code-only audit; statuses
Pass / Fail / Needs user verification; evidence from source.
- Checklist — Procedure step 3 plus Decision Rules (labels, combine children, 44×44 targets, Dynamic Type, focus, custom representations).
- Ambiguous SC — W3C WCAG 2.2 Quick Reference when a criterion's mobile applicability is unclear.
- API patterns — Decision Rules and Pitfalls in this file (SwiftUI first; UIKit only if bridges are in scope).
- Remediation — Procedure step 4 and the finding template (minimal snippets, P0/P1/P2).
- Manual follow-up — only when generating
# User Follow-Up Checks or a final manual validation list.
Procedure
1. Define Scope
- Identify the scoped feature flow and in-scope screens/states.
- Identify the SwiftUI entry views and related subviews for the feature.
- Note any
UIViewRepresentable / UIViewControllerRepresentable bridges and whether they materially affect accessibility.
2. Search the Code (SwiftUI-first)
Run these searches from the project root (PowerShell on Windows host):
rg --files | rg '\.swift$'
rg -n "struct .*View: View|body: some View|NavigationStack|sheet\(|fullScreenCover\(" .
rg -n "accessibility(Label|Hint|Value|Hidden)|accessibility(AddTraits|RemoveTraits)|accessibilityElement\(|accessibilityFocused\(" .
rg -n "@AccessibilityFocusState|onTapGesture|DragGesture|lineLimit\(|minimumScaleFactor|dynamicTypeSize" .
Then use Decision Rules and Pitfalls in this file for pattern interpretation (.accessibilityRepresentation, combined children).
3. Run the WCAG Checklist
- Walk through Decision Rules and Procedure step 3 against the in-scope code.
- Record evidence with statuses:
Pass, Fail, Needs user verification.
- Use the SwiftUI API examples to avoid false positives and identify missing semantics.
4. Generate Patch-Ready Fixes
- Use Procedure step 4, Decision Rules, and the finding template for fix patterns and priority.
- Produce minimal, directly applicable snippets for each finding.
- If no code snippet is appropriate, state why in
*Fix suggestion* (rare).
5. Produce the Report
Generate a Markdown report with:
- Prioritized findings (
P0, P1, P2)
- WCAG SC mapping for each finding
- Patch-ready snippet embedded in each finding
- User follow-up checks (only for code-indeterminate items)
Decision Rules
- Label vs. Hint: Use
.accessibilityLabel to describe what an element is. Use .accessibilityHint to describe what happens when activated. Do not repeat the label in the hint.
- Combine Children: Use
.accessibilityElement(children: .combine) on card components to read group details as a single element.
- Minimum Tap Targets: Controls must maintain a minimum interactive hit target of 44×44 points.
.contentShape(Rectangle()) can help expand transparent targets.
- Dynamic Type: Text sizes must scale automatically to accommodate user preferences. Check
lineLimit, minimumScaleFactor, dynamicTypeSize.
- Focus Management: Use
@AccessibilityFocusState to track and programmatically transfer focus between elements (iOS 18/19).
- Custom Representations: Use
.accessibilityRepresentation to overlay standard accessible controls on top of highly custom graphical interfaces.
Output Format (Strict, Concise)
Be concise. Use the following structure exactly.
Rules:
- Group findings by priority using top-level headings:
# Findings - P0, # Findings - P1, # Findings - P2
- Omit empty priority groups.
- Put the code snippet in the same finding section (not in a separate snippets section).
- Omit the WCAG coverage matrix unless the user explicitly asks for it.
- Add
# Scope / Assumptions only if ambiguity materially affects the audit.
- Add
# User Follow-Up Checks only if there are Needs user verification items.
Template for each finding:
# Findings - P1
## 1. <Problem name>
- **What**: <problem description with code evidence; include Confidence when useful, e.g. "Likely issue (confidence: medium)">
- **Where**: <file path + line(s)>
- **Fix suggestion**: <suggested fix in words>
- **WCAG**: <SC # - Title (Level)>
```swift
// patch-ready snippet
```
Notes:
- Keep snippets minimal and directly applicable to the cited code path.
- If no code snippet is appropriate, state why in
*Fix suggestion*.
Examples
Use $swiftui-wcag-accessibility-auditor to audit this SwiftUI checkout feature against WCAG 2.2 and return prioritized findings with patch-ready fixes in the strict finding format.
Use $swiftui-wcag-accessibility-auditor to review this SwiftUI login + OTP flow for accessible authentication (3.3.8) and suggest minimal code changes.
Use $swiftui-wcag-accessibility-auditor to audit this settings screen and produce user follow-up checks only for contrast, target size, and VoiceOver announcement timing.
Pitfalls
- Focus Loop Trap: If VoiceOver gets trapped in custom lists, programmatically manage the active accessibility focus element using
@AccessibilityFocusState.
- Contrast with Materials: If backdrop transparency (materials) compromises text contrast, apply
.accessibilityReduceTransparency() logic to fall back to high-contrast opaque styles.
- Color-only indicators: Never rely on color alone to convey state. Pair color with text, icon, or trait.
- False positives on custom modifiers: Always check Decision Rules and Pitfalls in this file before flagging a missing label — the element may use
.accessibilityRepresentation or combined children.
- UIKit bridges: If the feature delegates core behavior to UIKit, do not fabricate SwiftUI fixes. Narrow the audit or route to
mobile-accessibility-audit.
- Unverifiable claims: If a result cannot be proven from source (e.g., runtime contrast ratio, VoiceOver announcement timing), mark
Needs user verification — do not assert a pass or fail.
Verification
After producing the report, self-check:
- Every finding has all four fields: What, Where, Fix suggestion, WCAG SC mapping.
- Every finding has an embedded snippet or an explicit reason why none applies.
- No empty priority groups appear in the output.
- No WCAG coverage matrix is included unless the user explicitly requested it.
Needs user verification items appear under # User Follow-Up Checks with a concrete manual check.
- Scope is SwiftUI-native — no macOS, watchOS, web, or non-SwiftUI findings unless explicitly bridged.
Quick self-audit command (PowerShell):
rg -n "accessibilityLabel|accessibilityHint|accessibilityElement|accessibilityRepresentation|@AccessibilityFocusState|contentShape" .
Confirm that findings align with what is present vs. absent in the code.
Resources
This folder ships only SKILL.md. Use Overview, Procedure, Decision Rules, Output Format, and Pitfalls above.
Source Anchors
Related Skills
mobile-accessibility-audit — broader mobile audit including UIKit.
swiftui-accessibility-auditor — fast SwiftUI-only heuristic review without WCAG traceability.
Changelog
- 2026-05-30: Updated to WCAG 2.2 Level A/AA standards, adding dynamic focus states and custom accessibility representations.
- 2026-05-31: Re-checked W3C WCAG 2.2, Apple HIG, and Material Design sources.
1---2name: swiftui-wcag-accessibility-auditor3description: Audits native iOS SwiftUI source against WCAG 2.2 A/AA with VoiceOver labels, 44x44 targets, contrast, and patch-ready snippets. Use when auditing SwiftUI accessibility with WCAG traceability. Not for UIKit-first audits (mobile-accessibility-audit), heuristic-only SwiftUI review (swiftui-accessibility-auditor), or running the app.4---5
6# SwiftUI WCAG Accessibility Auditor
7
8## Overview
9
10Audit native iOS SwiftUI features in a dual mode:
11
12- **WCAG-driven coverage and evidence** — what fails, what is uncertain, and why, mapped to WCAG 2.2 Success Criteria.
13- **SwiftUI patch-ready remediation** — what to change with minimal code edits.
14
15Treat this as a **code audit**. Do not run the app. If a result cannot be proven from source, mark it `Needs user verification` and add a concrete user follow-up check.
16
17### Scope Rules
18
19- Audit **native iOS SwiftUI code only**.
20- Audit `UIViewRepresentable` / `UIViewControllerRepresentable` bridges only to the extent they affect the SwiftUI feature.
21- If the feature delegates core behavior to UIKit, say so and either narrow the audit or recommend `mobile-accessibility-audit`.
22- Do **not** broaden scope to macOS, watchOS, web, or non-SwiftUI implementations.
23
24### Compatibility Target
25
26- **Standards:** WCAG 2.2 Level A and AA.
27- **Devices:** iOS, iPadOS, tvOS.
28
29## When to Use
30
31Use this skill when you need **both**:
32
33- WCAG 2.2 mapping / traceability, **and**
34- SwiftUI-specific fixes/snippets.
35
36Trigger keywords: `accessibility audit`, `WCAG`, `VoiceOver`, `SwiftUI a11y`, `contrast`, `focus state`, `tap target`, `Dynamic Type`, `accessible authentication`.
37
38**Route elsewhere when:**
39
40- `mobile-accessibility-audit` — feature includes `UIKit` or you only need standards-first audit coverage.
41- `swiftui-accessibility-auditor` — you want a fast SwiftUI-only heuristic review without WCAG traceability.
42
43## Prerequisites
44
45- SwiftUI source files available in the workspace (`.swift`).
46- `ripgrep` (`rg`) available on the host for search guidance.
47- WCAG 2.2 and Apple SwiftUI accessibility docs reachable (see Source Anchors).
48
49### Audit load order
50
51Follow this order using **this SKILL.md** plus the Source Anchors — this folder does not ship extra reference files:
52
531. **Workflow** — Overview (Scope Rules, Compatibility Target) and Procedure. Code-only audit; statuses `Pass` / `Fail` / `Needs user verification`; evidence from source.
542. **Checklist** — Procedure step 3 plus Decision Rules (labels, combine children, 44×44 targets, Dynamic Type, focus, custom representations).
553. **Ambiguous SC** — [W3C WCAG 2.2 Quick Reference](https://www.w3.org/WAI/WCAG22/quickref/) when a criterion's mobile applicability is unclear.
564. **API patterns** — Decision Rules and Pitfalls in this file (SwiftUI first; UIKit only if bridges are in scope).
575. **Remediation** — Procedure step 4 and the finding template (minimal snippets, P0/P1/P2).
586. **Manual follow-up** — only when generating `# User Follow-Up Checks` or a final manual validation list.
59
60## Procedure
61
62### 1. Define Scope
63
641. Identify the scoped feature flow and in-scope screens/states.
652. Identify the SwiftUI entry views and related subviews for the feature.
663. Note any `UIViewRepresentable` / `UIViewControllerRepresentable` bridges and whether they materially affect accessibility.
67
68### 2. Search the Code (SwiftUI-first)
69
70Run these searches from the project root (PowerShell on Windows host):
71
72```powershell
73rg --files | rg '\.swift$'
74rg -n "struct .*View: View|body: some View|NavigationStack|sheet\(|fullScreenCover\(" .
75rg -n "accessibility(Label|Hint|Value|Hidden)|accessibility(AddTraits|RemoveTraits)|accessibilityElement\(|accessibilityFocused\(" .
76rg -n "@AccessibilityFocusState|onTapGesture|DragGesture|lineLimit\(|minimumScaleFactor|dynamicTypeSize" .
77```
78
79Then use Decision Rules and Pitfalls in this file for pattern interpretation (`.accessibilityRepresentation`, combined children).
80
81### 3. Run the WCAG Checklist
82
831. Walk through Decision Rules and Procedure step 3 against the in-scope code.
842. Record evidence with statuses: `Pass`, `Fail`, `Needs user verification`.
853. Use the SwiftUI API examples to avoid false positives and identify missing semantics.
86
87### 4. Generate Patch-Ready Fixes
88
891. Use Procedure step 4, Decision Rules, and the finding template for fix patterns and priority.
902. Produce minimal, directly applicable snippets for each finding.
913. If no code snippet is appropriate, state why in `*Fix suggestion*` (rare).
92
93### 5. Produce the Report
94
95Generate a Markdown report with:
96
97- Prioritized findings (`P0`, `P1`, `P2`)
98- WCAG SC mapping for each finding
99- Patch-ready snippet embedded in each finding
100- User follow-up checks (only for code-indeterminate items)
101
102### Decision Rules
103
1041. **Label vs. Hint:** Use `.accessibilityLabel` to describe *what* an element is. Use `.accessibilityHint` to describe *what happens* when activated. Do not repeat the label in the hint.
1052. **Combine Children:** Use `.accessibilityElement(children: .combine)` on card components to read group details as a single element.
1063. **Minimum Tap Targets:** Controls must maintain a minimum interactive hit target of 44×44 points. `.contentShape(Rectangle())` can help expand transparent targets.
1074. **Dynamic Type:** Text sizes must scale automatically to accommodate user preferences. Check `lineLimit`, `minimumScaleFactor`, `dynamicTypeSize`.
1085. **Focus Management:** Use `@AccessibilityFocusState` to track and programmatically transfer focus between elements (iOS 18/19).
1096. **Custom Representations:** Use `.accessibilityRepresentation` to overlay standard accessible controls on top of highly custom graphical interfaces.
110
111## Output Format (Strict, Concise)
112
113Be concise. Use the following structure exactly.
114
115**Rules:**
116
117- Group findings by priority using top-level headings: `# Findings - P0`, `# Findings - P1`, `# Findings - P2`
118- Omit empty priority groups.
119- Put the code snippet in the same finding section (not in a separate snippets section).
120- Omit the WCAG coverage matrix unless the user explicitly asks for it.
121- Add `# Scope / Assumptions` only if ambiguity materially affects the audit.
122- Add `# User Follow-Up Checks` only if there are `Needs user verification` items.
123
124**Template for each finding:**
125
126````md
127# Findings - P1
128
129## 1. <Problem name>
130- **What**: <problem description with code evidence; include Confidence when useful, e.g. "Likely issue (confidence: medium)">
131- **Where**: <file path + line(s)>
132- **Fix suggestion**: <suggested fix in words>
133- **WCAG**: <SC # - Title (Level)>
134
135```swift
136// patch-ready snippet
137```
138````
139
140**Notes:**
141
142- Keep snippets minimal and directly applicable to the cited code path.
143- If no code snippet is appropriate, state why in `*Fix suggestion*`.
144
145## Examples
146
147- `Use $swiftui-wcag-accessibility-auditor to audit this SwiftUI checkout feature against WCAG 2.2 and return prioritized findings with patch-ready fixes in the strict finding format.`
148- `Use $swiftui-wcag-accessibility-auditor to review this SwiftUI login + OTP flow for accessible authentication (3.3.8) and suggest minimal code changes.`
149- `Use $swiftui-wcag-accessibility-auditor to audit this settings screen and produce user follow-up checks only for contrast, target size, and VoiceOver announcement timing.`
150
151## Pitfalls
152
153- **Focus Loop Trap:** If VoiceOver gets trapped in custom lists, programmatically manage the active accessibility focus element using `@AccessibilityFocusState`.
154- **Contrast with Materials:** If backdrop transparency (materials) compromises text contrast, apply `.accessibilityReduceTransparency()` logic to fall back to high-contrast opaque styles.
155- **Color-only indicators:** Never rely on color alone to convey state. Pair color with text, icon, or trait.
156- **False positives on custom modifiers:** Always check Decision Rules and Pitfalls in this file before flagging a missing label — the element may use `.accessibilityRepresentation` or combined children.
157- **UIKit bridges:** If the feature delegates core behavior to UIKit, do not fabricate SwiftUI fixes. Narrow the audit or route to `mobile-accessibility-audit`.
158- **Unverifiable claims:** If a result cannot be proven from source (e.g., runtime contrast ratio, VoiceOver announcement timing), mark `Needs user verification` — do not assert a pass or fail.
159
160## Verification
161
162After producing the report, self-check:
163
1641. **Every finding has all four fields**: What, Where, Fix suggestion, WCAG SC mapping.
1652. **Every finding has an embedded snippet** or an explicit reason why none applies.
1663. **No empty priority groups** appear in the output.
1674. **No WCAG coverage matrix** is included unless the user explicitly requested it.
1685. **`Needs user verification` items** appear under `# User Follow-Up Checks` with a concrete manual check.
1696. **Scope is SwiftUI-native** — no macOS, watchOS, web, or non-SwiftUI findings unless explicitly bridged.
170
171Quick self-audit command (PowerShell):
172
173```powershell
174rg -n "accessibilityLabel|accessibilityHint|accessibilityElement|accessibilityRepresentation|@AccessibilityFocusState|contentShape" .
175```
176
177Confirm that findings align with what is present vs. absent in the code.
178
179## Resources
180
181This folder ships only `SKILL.md`. Use Overview, Procedure, Decision Rules, Output Format, and Pitfalls above.
182
183### Source Anchors
184
185- [W3C WCAG 2.2 Quick Reference](https://www.w3.org/WAI/WCAG22/quickref/)
186- [Apple SwiftUI Accessibility Guidelines](https://developer.apple.com/documentation/swiftui/accessibility)
187- [Apple Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/)
188
189## Related Skills
190
191- `mobile-accessibility-audit` — broader mobile audit including UIKit.
192- `swiftui-accessibility-auditor` — fast SwiftUI-only heuristic review without WCAG traceability.
193
194## Changelog
195
196- **2026-05-30:** Updated to WCAG 2.2 Level A/AA standards, adding dynamic focus states and custom accessibility representations.
197- **2026-05-31:** Re-checked W3C WCAG 2.2, Apple HIG, and Material Design sources.