Discussion
議論
An Accessibility Rotor is a shortcut for Accessibility users to quickly navigate to specific elements of the user interface, and optionally specific ranges of text within those elements.
Using this modifier requires that the Rotor be attached to a ScrollView
, or an Accessibility Element directly within a ScrollView
, such as a ForEach
.
In the following example, a Message application creates a Rotor allowing users to navigate to the headings in its vertical stack of messages.
ScrollView {
LazyVStack {
ForEach(messageListItems) { messageListItem in
switch messageListItem {
case .heading(let subject):
Text(subject)
case .message(let message):
MessageView(message)
}
}
}
}
.accessibilityElement(children: .contain)
.accessibilityRotor(
.heading, entries: headingMessageListItems, label: \.subject)