Contents

UITextSelectionHighlightView

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

Declaration

@MainActor protocol UITextSelectionHighlightView : UICoordinateSpace

Overview

Adopt the 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 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 CALayer objects or your view’s draw(_:) method to draw these rectangles.

After adopting this protocol in your custom view, assign your view to the highlightView property of the interaction object you attached to your text view.

Topics

Getting the rectangles to draw

See Also

Custom text selection