accessibilityAdjustableAction

Adds an accessibility adjustable action to the view. Actions allow assistive technologies, such as the VoiceOver, to interact with the view by invoking the action.

View ModifieriOS 13.0+macOS 10.15+tvOS 13.0+watchOS 6.0+accessibilityAdjustableAction(_:) in SwiftUI

Declaration

React
compose().accessibilityAdjustableAction(
  handler: (arg0: SwiftUI.AccessibilityAdjustmentDirection) => void
)
Swift
nonisolated func accessibilityAdjustableAction(
    _ handler: @escaping (AccessibilityAdjustmentDirection) -> Void
) -> ModifiedContent<Self, AccessibilityAttachmentModifier>

Parameters

Discussion

For example, this is how an adjustable action to navigate through pages could be added to a view.

var body: some View {
    PageControl()
        .accessibilityAdjustableAction { direction in
            switch direction {
            case .increment:
                // Go to next page
            case .decrement:
                // Go to previous page
            }
        }
}

See also

More in Accessibility.