<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSAccessibilityProtocol/accessibilityStyleRange(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSAccessibility(im)accessibilityStyleRangeForIndex:"
  },
  "title" : "accessibilityStyleRange(for:)"
}
-->

# accessibilityStyleRange(for:)

Returns a range of characters that all have the same style as the specified character.

```
func accessibilityStyleRange(for index: Int) -> NSRange
```

## Parameters

`index`

The index of the specified character.

## Return Value

A range of characters with the same style as the specified character.

## Discussion

This method returns a range of characters that meet two conditions: The range must include the specified character, and all the other characters in the range must match the specified character’s style. If none of the adjacent characters match the specified character’s style, the method returns only the specified character.

---

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)