---
title: "selectionRects(for:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextinput/selectionrects(for:)"
---

# selectionRects(for:)

Returns an array of selection rects corresponding to the range of text.

## Declaration

```swift
func selectionRects(for range: UITextRange) -> [UITextSelectionRect]
```

## Parameters

- `range`: An object representing a range in a document’s text.

## Return Value

Return Value An array of UITextSelectionRect objects that encompass the selection.

## See Also

### Working with geometry and hit-testing

- [firstRect(for:)](uikit/uitextinput/firstrect(for:).md)
- [closestPosition(to:)](uikit/uitextinput/closestposition(to:).md)
- [closestPosition(to:within:)](uikit/uitextinput/closestposition(to:within:).md)
- [characterRange(at:)](uikit/uitextinput/characterrange(at:).md)
