---
title: selectedRange
framework: AppKit
role: symbol
role_heading: Instance Method
platforms: [macOS 10.0+]
path: appkit/nstextinput/selectedrange
---

# selectedRange

Returns the range of selected text.

## Declaration

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

## Return Value

Return Value The range of selected text.

## Discussion

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.

## See Also

### Deprecated methods

- [hasMarkedText](appkit/nstextinput/hasmarkedtext.md)
- [markedRange](appkit/nstextinput/markedrange.md)
- [setMarkedText:selectedRange:](appkit/nstextinput/setmarkedtext:selectedrange:.md)
- [unmarkText](appkit/nstextinput/unmarktext.md)
- [validAttributesForMarkedText](appkit/nstextinput/validattributesformarkedtext.md)
- [attributedSubstringFromRange:](appkit/nstextinput/attributedsubstringfromrange:.md)
- [insertText:](appkit/nstextinput/inserttext:.md)
- [characterIndexForPoint:](appkit/nstextinput/characterindexforpoint:.md)
- [firstRectForCharacterRange:](appkit/nstextinput/firstrectforcharacterrange:.md)
- [doCommandBySelector:](appkit/nstextinput/docommandbyselector:.md)
- [conversationIdentifier](appkit/nstextinput/conversationidentifier.md)
