<!--
{
  "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/UITextSelectionHandleView",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITextSelectionHandleView"
  },
  "title" : "UITextSelectionHandleView"
}
-->

# UITextSelectionHandleView

An interface you use to draw custom the selection handles for ranges of text.

```
@MainActor protocol UITextSelectionHandleView : UICoordinateSpace
```

## Overview

Adopt the [`UITextSelectionHandleView`](/documentation/UIKit/UITextSelectionHandleView) protocol in a custom view you use to draw text-selection handles 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 preferred frame for the selection handle, and you provide details about the handle back to the system. Use <doc://com.apple.documentation/documentation/QuartzCore/CALayer> objects or your view’s [`draw(_:)`](/documentation/UIKit/UIView/draw(_:)) method to draw the handles.

After adopting this protocol in your custom view, create exactly two instances and assign them to the [`handleViews`](/documentation/UIKit/UITextSelectionDisplayInteraction/handleViews) property of the interaction object you attached to your text view. Configure one instance as the leading selection handle, and configure the other instance as the trailing selection handle.

## Topics

### Providing the preferred frame rectangle

[`func preferredFrame(for: CGRect) -> CGRect`](/documentation/UIKit/UITextSelectionHandleView/preferredFrame(for:))

Provides a preferred frame given @c rect based on the current appearance configuration.

### Specifying the handle details

[`var direction: NSDirectionalRectEdge`](/documentation/UIKit/UITextSelectionHandleView/direction)

The orientation of the selection handle.

[`var customShape: UIBezierPath?`](/documentation/UIKit/UITextSelectionHandleView/customShape)

The custom shape to draw for the stem of the selection handle.

[`var isVertical: Bool`](/documentation/UIKit/UITextSelectionHandleView/isVertical)

Convenience accessor for @c direction calculations.

## Relationships

### Inherits From

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

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

---

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)