Instance Property

selectionAffinity

The desired location for the insertion point.

Declaration

optional var selectionAffinity: UITextStorageDirection { get set }

Discussion

For text selections that wrap across line boundaries, this property determines whether the insertion point appears after the last character on the line or before the first character on the following line. The selection affinity is set in response to the user navigating via the keyboard (for example, command-right-arrow). The text input system checks this property when it moves the insertion point around in a document.

In the default implementation, if the selection is not at the end of the line, or if the selection is at the start of a paragraph for an empty line, a forward direction is assumed (UITextStorageDirection.forward); otherwise, a backward direction UITextStorageDirection.backward is assumed.

See Also

Working with Marked and Selected Text

var selectedTextRange: UITextRange?

The range of selected text in a document.

Required.

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.