100 Days of SwiftUI
2026-07-27
Project 15, part 1
Accessibility — don’t leave people out. This section is primarily aimed at people using screen readers such as VoiceOver.
VoiceOver can’t be done in the simulator
Identifying views with useful labels
We can control what VoiceOver reads for a given view by attaching two modifiers:
.accessibilityLabel()and.accessibilityHint()
It’s important to think about what your VoiceOver user is going to hear every time they use your app.
It is more accessible and less code to just have a button instead of an onTapGesture() on, say, an Image view
Hiding and grouping accessibility data
Most VoiceOver users are experienced at it, so try to streamline
- Mark images as being unimportant for VoiceOver.
Image(decorative: ...)
- Hide views from the accessibility system.
.accessibilityHidden(true)
- Group several views as one.
.accessibilityElement(children: .combine)which has a brief pause between elements..accessibilityElement()does not
Reading the value of controls

3 treats!This is the code — the goal is to improve high-value information flow to the user
VStack {
Text("Value: \(value)")
Button("Increment") {
value += 1
}
Button("Decrement") {
value -= 1
}
}
.accessibilityElement()
.accessibilityLabel("Value")
.accessibilityValue(String(value))
.accessibilityAdjustableAction { direction in
switch direction {
case .increment:
value += 1
case .decrement:
value -= 1
default:
print("Not handled.")
}
}