Skip to main content
Logo Appt Light

Accessibility action on iOS

Accessibility actions provide alternative ways for users of assistive technologies to perform actions. For users of switch control it can be difficult to use drag-and-drop functionality. This functionality can be made more accessible by providing accessibility actions to move items up and down.

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
}

Feedback?

Let us know!