---
title: "text(in:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextinput/text(in:)"
---

# text(in:)

Returns the text in the specified range.

## Declaration

```swift
func text(in range: UITextRange) -> String?
```

## Parameters

- `range`: A range of text in a document.

## Return Value

Return Value A substring of a document that falls within the specified range.

## See Also

### Replacing and returning text

- [replace(_:withText:)](uikit/uitextinput/replace(_:withtext:).md)
- [shouldChangeText(in:replacementText:)](uikit/uitextinput/shouldchangetext(in:replacementtext:).md)
