Protocol

UITextDocumentProxy

An object that provides textual context to a custom keyboard.

Declaration

protocol UITextDocumentProxy

Overview

Through conformance to the UIKeyInput protocol, a text document proxy enables a custom keyboard (which is based on the UIInputViewController class) to insert and delete text, to adjust the position of the insertion point, and to determine whether a text input object is empty. The text document proxy uses the keyboard's textDocumentProxy property to do this.

For more about using a text document proxy, see UIInputViewController and Custom Keyboard in App Extension Programming Guide.

Topics

Getting the Text Input Mode

var documentInputMode: UITextInputMode?

The text input mode to use for the keyboard.

Required.

Obtaining Textual Context Around the Insertion Point

var documentContextAfterInput: String?

Textual context after the insertion point in the current text input object.

Required.

var documentContextBeforeInput: String?

Textual context before the insertion point in the current text input object.

Required.

Adjusting the Insertion Point Position

func adjustTextPosition(byCharacterOffset: Int)

Moves the insertion point forward or backward in the current text input object.

Required.

Getting the Selected Text

var selectedText: String?

The currently selected text in the document.

Required.

Distinguishing Changes in the Document

var documentIdentifier: UUID

The unique identifier for this document.

Required.

Relationships

Inherits From

See Also

Custom Keyboard

protocol UIInputViewAudioFeedback

A property that enables a custom input or keyboard accessory view to play standard keyboard input clicks.

class UIInputViewController

The primary view controller for a custom keyboard app extension.

class UILexicon

A read-only array of term pairs, each in a lexicon entry object, for use by a custom keyboard.

class UILexiconEntry

A read-only term pair, available within a lexicon object, for use by a custom keyboard.