position(from:in:offset:)
Returns the text position at a specified offset in a specified direction from another text position.
Declaration
func position(from position: UITextPosition, in direction: UITextLayoutDirection, offset: Int) -> UITextPosition?Parameters
- position:
A custom Uitextposition object that represents a location in a document.
- direction:
A Uitextlayoutdirection constant that represents the direction of the offset from
position. Returnnilif the computed text position is less than 0 or greater than the length of the backing string. - offset:
A character offset from
position.
Discussion
For an example of an implementation of the related method, position(from:offset:), see Using Text Kit to Draw and Manage Text in Text Programming Guide for iOS.