---
title: selectedTextRange
framework: uikit
role: symbol
role_heading: Instance Property
path: uikit/uitextsearching-3wkjv/selectedtextrange
---

# selectedTextRange

The range of selected text in a document.

## Declaration

```swift
var selectedTextRange: UITextRange? { get }
```

## Discussion

Discussion If the text range has a length, it indicates the currently selected text. If it has zero length, it indicates the caret (insertion point). If the text-range object is nil, it indicates that there’s no current selection.

## See Also

### Identifying selected text

- [selectedTextSearchDocument](uikit/uitextsearching-3wkjv/selectedtextsearchdocument.md)
