<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextDragPreviewRenderer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UITextDragPreviewRenderer"
  },
  "title" : "UITextDragPreviewRenderer"
}
-->

# UITextDragPreviewRenderer

Renders previews of text dragged by the user.

```
@MainActor class UITextDragPreviewRenderer
```

## Overview

Use this class to provide custom previews of dragged text that follows user interface guidelines and handles right-to-left text. You provide the layout manager and the range to render the preview.

Subclasses may override the [`adjust(firstLineRect:bodyRect:lastLineRect:textOrigin:)`](/documentation/UIKit/UITextDragPreviewRenderer/adjust(firstLineRect:bodyRect:lastLineRect:textOrigin:)) method to modify the detected rectangles as needed during the drag operation.

## Topics

### Initializing a text drag preview renderer

[`init(layoutManager:range:)`](/documentation/UIKit/UITextDragPreviewRenderer/init(layoutManager:range:))

Initializes and returns a text drag preview renderer with the specified layout managers and range to render the text drag preview.

[`init(layoutManager:range:unifyRects:)`](/documentation/UIKit/UITextDragPreviewRenderer/init(layoutManager:range:unifyRects:))

Returns an initialized renderer of a text drag preview with the specified layout manager, range, and rectangle detection behavior.

### Getting and setting bounding rectangles

[`bodyRect`](/documentation/UIKit/UITextDragPreviewRenderer/bodyRect)

The bounding rectangle of the text in the middle of the drag preview.

[`firstLineRect`](/documentation/UIKit/UITextDragPreviewRenderer/firstLineRect)

The bounding rectangle of the first line of text in the drag preview.

[`lastLineRect`](/documentation/UIKit/UITextDragPreviewRenderer/lastLineRect)

The bounding rectangle of the last line of text in the drag preview.

[`adjust(firstLineRect:bodyRect:lastLineRect:textOrigin:)`](/documentation/UIKit/UITextDragPreviewRenderer/adjust(firstLineRect:bodyRect:lastLineRect:textOrigin:))

Adjusts the size and origin of the bounding rectangles during a text drag operation.

### Getting the preview image

[`image`](/documentation/UIKit/UITextDragPreviewRenderer/image)

The image of the text drag preview that’s rendered by the layout manager.

### Getting the layout manager

[`layoutManager`](/documentation/UIKit/UITextDragPreviewRenderer/layoutManager)

The layout manager that renders the text drag preview.



---

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)