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
. When the user navigates to entries from this Rotor, SwiftUI will automatically scroll them into place as needed.
In the following example, a Message application creates a Rotor allowing users to navigate to specifically the messages originating from VIPs. // messages
is a list of Message
s that have a subject
and a // uuid
. vipMessages
is a filtered version of that list // containing only messages from VIPs. ScrollView { LazyVStack { ForEach(messages) { message in MessageView(message) } } } .accessibilityElement(children: .contain) .accessibilityRotor(“VIPs”, entries: vipMessages, id: .uuid, label: .subject)