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

# selectedRange

Returns the range of selected text.

```
- (NSRange) selectedRange;
```

## Return Value

The range of selected text.

## Discussion

The returned range measures from the start of the receiver’s text storage. If there is no selection, the return value’s `location` is `NSNotFound`, and its `length` is 0.

---

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)