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

# selectedRange()

Returns the range of selected text.

```
func selectedRange() -> NSRange
```

## Return Value

The range of selected text or `{NSNotFound, 0}` if there is no selection.

## Discussion

The returned range measures from the start of the receiver’s text storage, that is, from 0 to the document length.

---

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)