Instance Property

selectedTextRange

The range of selected text in a document.

Required.

Declaration

@NSCopying var selectedTextRange: UITextRange? { get set }

Discussion

If the text range has a length, it indicates the currently selected text. If it has zero length, it indicates the caret (insertion point). If the text-range object is nil, it indicates that there is no current selection.

See Also

Working with Marked and Selected Text

var markedTextRange: UITextRange?

The range of text that is currently marked in a document.

Required.

var markedTextStyle: [NSAttributedString.Key : Any]?

A dictionary of attributes that describes how marked text should be drawn.

Required.

func setMarkedText(String?, selectedRange: NSRange)

Insert the provided text and marks it to indicate that it is part of an active input session.

Required.

func unmarkText()

Unmark the currently marked text.

Required.

var selectionAffinity: UITextStorageDirection

The desired location for the insertion point.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software