Localized label identifying this Rotor to the user.
Instance Method
インスタンスメソッド
accessibility
accessibilityRotor(_:entries:)
Create an Accessibility Rotor with the specified user-visible label, and entries generated from the content closure.
Availability 有効性
- iOS 15.0+
- iPadOS 15.0+
- macOS 12.0+
- Mac Catalyst 15.0+
- tvOS 15.0+
- watchOS 8.0+
Technology
- Swift
UI
Declaration 宣言
func accessibilityRotor<Content>(_ labelKey: LocalizedStringKey
, entries: @escaping () -> Content) -> some View
where Content : AccessibilityRotorContent
Parameters パラメータ
labelKey
entries
Content used to generate Rotor entries. This can include AccessibilityRotorEntry structs, as well as constructs such as if and ForEach.
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.
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 `Identifiable` `Message`s.
ScrollView {
LazyVStack {
ForEach(messages) { message in
MessageView(message)
}
}
}
.accessibilityElement(children: .contain)
.accessibilityRotor("VIPs") {
// Not all the MessageViews are generated at once, the model
// knows about all the messages.
ForEach(messages) { message in
// If the Message is from a VIP, make a Rotor entry for it.
if message.isVIP {
AccessibilityRotorEntry(message.subject, id: message.id)
}
}
}