<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/accessibilityRotor(_:textRanges:)-53aet",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE18accessibilityRotor_10textRangesQrqd___SaySnySS5IndexVGGtSyRd__lF"
  },
  "title" : "accessibilityRotor(_:textRanges:)"
}
-->

# accessibilityRotor(_:textRanges:)

Create an Accessibility Rotor with the specified user-visible label
and entries for each of the specified ranges. The Rotor will be attached
to the current Accessibility element, and each entry will go the
specified range of that element.

```
nonisolated func accessibilityRotor<L>(_ label: L, textRanges: [Range<String.Index>]) -> some View where L : StringProtocol
```

## Parameters

`label`

Localized label identifying this Rotor to the user.

`textRanges`

An array of ranges that will be used to generate
the entries of the Rotor.

## 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 adds a Rotor allowing
the user to navigate through all the ranges of text containing
email addresses.

```
extension Message {
    // Ranges of special areas in the `content` text. Calculated
    // when `content` is set and then cached so that we don't have
    // to re-compute them.
    var emailAddressRanges: [Range<String.Index>]
}

struct MessageContentView: View {
    TextEditor(.constant(message.content))
        .accessibilityRotor("Email Addresses",
            textRanges: message.emailAddressRanges)
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)