func accessibilityRespondsToUserInteraction (Bool) -> ModifiedContent <Self, AccessibilityAttachmentModifier >
A hidden view that the accessibility system uses to generate accessibility elements.
Availability 有効性
Technology
representation
A hidden view that the accessibility system uses to generate accessibility elements.
You can make controls accessible by using a custom style. For example, a custom Toggle
that you create inherits the accessibility features of Toggle
automatically. When you can’t use the parent view’s accessibility elements, use the accessibility
modifier instead. This modifier replaces default accessibility elements with different accessibility elements that you provide. You use synthetic, non-visual accessibility elements to represent what the view displays.
The example below makes a custom adjustable control accessible by explicitly defining the representation of its step increments using a Slider
:
var body: some View {
VStack {
SliderTrack(...) // Custom slider implementation.
}
.accessibilityRepresentation {
Slider(value: $value, in: 0...100) {
Text("Label")
}
}
}
SwiftUI hides the view that you provide in the representation
closure and makes it non-interactive. The framework uses it only to generate accessibility elements.
func accessibilityRespondsToUserInteraction (Bool) -> ModifiedContent <Self, AccessibilityAttachmentModifier >