How it works
AccessibilityTechnologies describes the set of assistive technologies — such as VoiceOver or Switch Control — that may be interacting with a view. Because a user can have more than one assistive technology engaged at once, the type models a *set* of options rather than a single mode, letting you tailor behavior or presentation to the specific tools in play. Reach for it when you need to know which assistive technologies are active so your view can adapt to them, for example when SwiftUI hands you a value in an accessibility-related context.
Treat it as an option set
AccessibilityTechnologiesconforms toOptionSet, so a value is a collection of flags rather than one case. You can build a value from an array literal of its members, as inlet active: AccessibilityTechnologies = [.voiceOver, .switchControl], which represents both technologies being active simultaneously.Reference individual technologies as static members
Each supported assistive technology is exposed as a static option you compose into a set. Here
.voiceOverand.switchControlname the two technologies of interest; you spell them with leading-dot syntax because the contextual type is alreadyAccessibilityTechnologies.Test membership with contains(_:)
Inherited from
OptionSet,contains(_:)answers whether a given technology is part of the set. The example branches onactive.contains(.voiceOver)andactive.contains(.switchControl)to decide whichsystemImageeachLabelshould show, so the row reflects whether that specific tool is engaged.Combine and refine sets with set algebra
Being an
OptionSet, values supportunion(_:),intersection(_:),insert(_:), andremove(_:), so you can merge or filter technologies without manual bit work. This lets you derive a value — for instance the technologies common to two contexts — and then drive your view from the result the same wayactivedrives theLabels here.
.switchControl from the active literal so it reads [.voiceOver], and watch the Switch Control Label's systemImage fall back to "circle" while VoiceOver stays checked.Example & preview
Press Run live & edit to compile it in your browser — then edit the Swift on the left and the preview re-renders live.
struct AccessibilityTechnologiesDemo: View {
let active: AccessibilityTechnologies = [.voiceOver, .switchControl]
var body: some View {
VStack(alignment: .leading, spacing: 8) {
Text("Assistive Tech")
.font(.headline)
Label("VoiceOver", systemImage: active.contains(.voiceOver) ? "checkmark.circle.fill" : "circle")
Label("Switch Control", systemImage: active.contains(.switchControl) ? "checkmark.circle.fill" : "circle")
}
.padding()
}
}