Accessibility action - iOS
On iOS, you can use UIAccessibilityCustomAction
to add custom actions for assistive technologies. You can also use UIAccessibilityCustomRotor
to add custom actions to the VoiceOver rotor. Furthermore, you can use the accessibilityActivate
method to override the action that happens when a user activates an element, e.g. by double tapping with the screen reader.
// Custom action
let customAction = UIAccessibilityCustomAction(
name: "Appt action",
actionHandler: { (action: UIAccessibilityCustomAction) -> Bool in
// Logic
return true
}
)
accessibilityCustomActions = [customAction]
// Custom rotor
let customRotor = UIAccessibilityCustomRotor(name: "Appt rotor") { predicate in
// Logic
}
accessibilityCustomRotors = [customRotor]
// Custom activation
override func accessibilityActivate() -> Bool {
// Logic
return true // True if the element was activated, false if not
}