---
title: "caretRect(for:)"
framework: browserenginekit
role: symbol
role_heading: Instance Method
path: "browserenginekit/betextinput/caretrect(for:)"
---

# caretRect(for:)

Returns a rectangle in which the system can draw the text-selection caret.

## Declaration

```swift
func caretRect(for position: UITextPosition) -> CGRect
```

## Parameters

- `position`: The text position corresponding to the caret’s location.

## Mentioned in

Integrating custom browser text views with UIKit
