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

# firstRect(for:)

Returns the first rectangle that encloses a range of text in a document.

```
func firstRect(for range: UITextRange) -> CGRect
```

## Parameters

`range`

An object that represents a range of text in a document.

## Return Value

The first rectangle in a `range` of text. You might use this rectangle to draw a correction rectangle. The “first” in the name refers the rectangle enclosing the first line when the range encompasses multiple lines of text.

## See Also

[`caretRect(for:)`](/documentation/UIKit/UITextInput/caretRect(for:))

Returns a rectangle to draw the caret at a specified insertion point.



---

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)