accessibilityZoomAction(_:)
Adds an accessibility zoom action to the view. Actions allow assistive technologies, such as VoiceOver, to interact with the view by invoking the action.
Declaration
nonisolated func accessibilityZoomAction(_ handler: @escaping (AccessibilityZoomGestureAction) -> Void) -> ModifiedContent<Content, Modifier>Discussion
For example, this is how a zoom action is used to transform the scale of a shape which has a MagnificationGesture.
var body: some View {
Circle()
.scaleEffect(magnifyBy)
.gesture(magnification)
.accessibilityLabel("Circle Magnifier")
.accessibilityZoomAction { action in
switch action.direction {
case .zoomIn:
magnifyBy += 0.5
case .zoomOut:
magnifyBy -= 0.5
}
}
}