<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextInput/selectionRects(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITextInput(im)selectionRectsForRange:"
  },
  "title" : "selectionRects(for:)"
}
-->

# selectionRects(for:)

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

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

## Parameters

`range`

An object representing a range in a document’s text.

## Return Value

An array of [`UITextSelectionRect`](/documentation/UIKit/UITextSelectionRect) objects that encompass the selection.

---

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)