SwiftUI app accessibility implementation guide.
Directory structure
swiftui-accessibility/
├── SKILL.md (このファイル)
└── references/
└── accessibility.md
Reference files
references/accessibility.md
Accessibility implementation guide:
- VoiceOver support:
- accessibilityLabel: description of the element
- accessibilityHint: hint for the operation
- accessibilityValue: current value
- accessibilityTraits: type of element
- Dynamic Type:
- Font scaling
- Layout support
- Color contrast:
- WCAG standards
- Dark mode support
- Motion:
- reduceMotion support
- Animation alternatives
- Testing and tools:
- Accessibility Inspector
- How to test with VoiceOver
Usage
When implementing accessibility
references/accessibility.md: check implementation patterns- Test with VoiceOver
- Check layout with Dynamic Type
During PR review
- Check whether accessibility labels are present
- Check whether images have alt text
- Check whether tap areas are sufficient
Quick implementation guide
VoiceOver basics
// ラベル(必須)
Image(systemName: "heart.fill")
.accessibilityLabel("お気に入り")
// ヒント(操作説明)
Button("削除") { }
.accessibilityHint("この項目を削除します")
// 値(現在の状態)
Slider(value: $volume)
.accessibilityValue("\(Int(volume))パーセント")
Dynamic Type support
// 推奨: システムフォント
Text("Hello")
.font(.body)
// カスタムフォントのスケーリング
Text("Hello")
.font(.custom("MyFont", size: 16, relativeTo: .body))
reduceMotion support
@Environment(\.accessibilityReduceMotion) var reduceMotion
var body: some View {
content
.animation(reduceMotion ? nil : .default, value: isExpanded)
}
Checklist
- Do all interactive elements have an accessibilityLabel?
- Do images have appropriate descriptions?
- Does the layout break with Dynamic Type?
- Is there no information conveyed by color alone?
- Are tap areas 44pt or larger?
Related skills
- swiftui-coding-guidelines: basic best practices
- swiftui-code-review-checklist: accessibility check during PR review