Protocol

UITextInputTokenizer

An instance of a class that adopts the UITextInputTokenizer protocol is a tokenizer; a tokenizer allows the text input system to evaluate text units of different granularities. Granularities of text units are always evaluated with reference to a storage or reference direction.

Overview

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

Symbols

Determining Text Positions Relative to Unit Boundaries

func isPosition(UITextPosition, atBoundary: UITextGranularity, inDirection: UITextDirection)
Required.

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

func isPosition(UITextPosition, withinTextUnit: UITextGranularity, inDirection: UITextDirection)
Required.

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

Computing Text Position by Unit Boundaries

func position(from: UITextPosition, toBoundary: UITextGranularity, inDirection: UITextDirection)
Required.

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

Getting Ranges of Specific Text Units

func rangeEnclosingPosition(UITextPosition, with: UITextGranularity, inDirection: UITextDirection)
Required.

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

Constants

UITextDirection

A direction of the text.

UITextGranularity

The granularity of a unit of text.

Relationships

Inherits From