元のドキュメント: developer.apple.com/documentation/swiftui/view/accessibilityrotor(_:entries:entrylabel:)


インスタンスメソッド


accessibilityRotor(_:entries:entryLabel:)


指定されたユーザー可視ラベルとエントリを使用して、アクセシビリティローターを作成します。


iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+

tvOS 15.0+ visionOS 1.0+ watchOS 8.0+

nonisolated
func
accessibilityRotor<EntryModel>(
_ rotorLabel: Text,
entries: [EntryModel],
entryLabel: KeyPath<EntryModel, String>
) -> some View where EntryModel : Identifiable

nonisolated
func
accessibilityRotor<EntryModel>(
_ rotorLabelKey: LocalizedStringKey,
entries: [EntryModel],
entryLabel: KeyPath<EntryModel, String>
) -> some View where EntryModel : Identifiable

nonisolated
func
accessibilityRotor<EntryModel>(
_ rotorLabelResource: LocalizedStringResource,
entries: [EntryModel],
entryLabel: KeyPath<EntryModel, String>
) -> some View where EntryModel : Identifiable

nonisolated
func
accessibilityRotor<EntryModel>(
_ systemRotor: AccessibilitySystemRotor,
entries: [EntryModel],
entryLabel: KeyPath<EntryModel, String>
) -> some View where EntryModel : Identifiable

nonisolated
func
accessibilityRotor<EntryModel>(
_ rotorLabel: L,
entries: [EntryModel],
entryLabel: KeyPath<EntryModel, String>
) -> some View where EntryModel : Identifiable




パラメータ


rotorLabel

ユーザーに対してこのローターを識別するためのローカライズされたラベル。


entries

ローターのエントリを生成するために使用される、識別可能な値の配列。Identifiable な値の識別子は、ForEach 内の識別子、または ScrollView 内の明示的な id 呼び出しと一致しなければなりません。ユーザーがこのローターからエントリに移動すると、SwiftUI は必要に応じて自動的にエントリを適切な位置にスクロールします。


entryLabel

Identifiable 型のキーパス。これを使用すると、各 Rotor エントリに対してユーザーの可視ラベルを取得できます。これは、macOS でユーザーが Rotor のエントリ一覧を開いたときに使用されます。



議論


アクセシビリティローターは、アクセシビリティ機能を利用するユーザーがユーザーインターフェースの特定の要素、あるいはその要素内の特定のテキスト範囲に素早く移動するためのショートカットです。


この修飾子を使用するには、ローターを ScrollView に付属させるか、ScrollView 内に直接アクセシビリティ要素(ForEach など)を配置する必要があります。


以下の例では、メッセージアプリケーションがローターを作成し、ユーザーが VIP から発信されたメッセージに特化してアクセスできるようにします。


// `messages` is a list of `Identifiable` `Message`s that have a
// `subject`.
// `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, label: \.subject)




以下も見よ


ローターを使った作業


func accessibilityRotor(_:entries:)

指定されたユーザー可視ラベルと、コンテンツクロージャから生成されたエントリを使用して、アクセシビリティローターを作成します。


func accessibilityRotor(_:entries:entryID:entryLabel:)

指定されたユーザー可視ラベルとエントリを使用して、アクセシビリティローターを作成します。


func accessibilityRotor(_:textRanges:)

指定されたユーザー可視ラベルと、指定された各範囲のエントリを持つアクセシビリティローターを作成します。ローターは現在のアクセシビリティ要素に付属され、各エントリはその要素の指定された範囲に配置されます。














トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ












トップへ