Protocol

UITextInputTokenizer

A tokenizer, which is an object that allows the text input system to evaluate text units of different granularities.

Declaration

protocol UITextInputTokenizer

Overview

Granularities of text units are always evaluated with reference to a storage or reference direction.

Text-processing objects that conform to the UITextInput protocol must hold a reference to a tokenizer (via the tokenizer property). The UITextInputStringTokenizer class provides a default base implementation of the UITextInputTokenizer protocol. Tokenizers of this class are suitable for most western-language keyboards. Apps with different requirements may adopt the UITextInputTokenizer protocol and create their own tokenizers.

Topics

Determining Text Positions Relative to Unit Boundaries

func isPosition(UITextPosition, atBoundary: UITextGranularity, inDirection: UITextDirection) -> Bool

Return whether a text position is at a boundary of a text unit of a specified granularity in a specified direction.

Required.

func isPosition(UITextPosition, withinTextUnit: UITextGranularity, inDirection: UITextDirection) -> Bool

Return whether a text position is within a text unit of a specified granularity in a specified direction.

Required.

Computing Text Position by Unit Boundaries

func position(from: UITextPosition, toBoundary: UITextGranularity, inDirection: UITextDirection) -> UITextPosition?

Return the next text position at a boundary of a text unit of the given granularity in a given direction.

Required.

Getting Ranges of Specific Text Units

func rangeEnclosingPosition(UITextPosition, with: UITextGranularity, inDirection: UITextDirection) -> UITextRange?

Return the range for the text enclosing a text position in a text unit of a given granularity in a given direction.

Required.

Constants

struct UITextDirection

A direction of the text.

enum UITextGranularity

The granularity of a unit of text.

Relationships

Inherits From

See Also

Input

protocol UITextInput

A set of methods you implement to interact with the text input system and enable features such as autocorrection and multistage text input in documents.

protocol UITextInputDelegate

An intermediary between a document and the text input system.

protocol UIKeyInput

A set of methods a subclass of UIResponder uses to implement simple text entry.

class UITextInputMode

The current text-input mode.

class UITextInputStringTokenizer

A base implementation of the UITextInputTokenizer protocol.

class UIDictationPhrase

An object that represents the textual interpretation of a spoken phrase as dictated by a user.

class UIInputView

An object that displays and manages custom input for a view when that view becomes the first responder.