Contents

positionOfToken(at:)

Converts a token index into a text position.

Declaration

func positionOfToken(at tokenIndex: Int) -> UITextPosition

Parameters

  • tokenIndex:

    The array index of the token.

Return Value

The text position of the token.

Discussion

Use this method to convert a token’s index in the tokens array into the token’s UITextPosition in the overall contents of the text field. Many UITextInput methods for interacting with text take a UITextPosition or UITextRange (constructed from two text positions) as a parameter.

To select a search token, assign a UITextRange that contains the token’s position to the selectedTextRange property.

See Also

Customizing token behavior