<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextSelectionHighlightView",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITextSelectionHighlightView"
  },
  "title" : "UITextSelectionHighlightView"
}
-->

# UITextSelectionHighlightView

An interface you use to provide a custom highlight UI behind the selected text.

```
@MainActor protocol UITextSelectionHighlightView : UICoordinateSpace
```

## Overview

Adopt the [`UITextSelectionHighlightView`](/documentation/UIKit/UITextSelectionHighlightView) protocol in a custom view you use to draw the highlight behind text in one of your text views. Use your custom view in conjunction with a [`UITextSelectionDisplayInteraction`](/documentation/UIKit/UITextSelectionDisplayInteraction) object to apply your custom selection UI to one of your text views. This protocol provides the rectangles for your view to fill with the highlight color and appearance. Use <doc://com.apple.documentation/documentation/QuartzCore/CALayer> objects or your view’s [`draw(_:)`](/documentation/UIKit/UIView/draw(_:)) method to draw these rectangles.

After adopting this protocol in your custom view, assign your view to the [`highlightView`](/documentation/UIKit/UITextSelectionDisplayInteraction/highlightView) property of the interaction object you attached to your text view.

## Topics

### Getting the rectangles to draw

[`var selectionRects: [UITextSelectionRect]`](/documentation/UIKit/UITextSelectionHighlightView/selectionRects)

The rectangles to draw with the selection highlight.

## Relationships

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`UICoordinateSpace`](/documentation/UIKit/UICoordinateSpace)

---

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)