position(within:atCharacterOffset:)
Returns the position within a range of a document’s text that corresponds to the character offset from the start of that range.
Declaration
optional func position(within range: UITextRange, atCharacterOffset offset: Int) -> UITextPosition?Parameters
- range:
An object that specifies a range of text in a document.
- offset:
A character offset from the start of
range.
Return Value
An object that represents a position in a document’s visible text.
Discussion
You should implement this method if you don’t have a one-to-one correspondence between UITextPosition objects within the given range and character offsets into a document string.