enumerateCaretOffsetsInLineFragment(at:using:)
Enumerates all the insertion point caret offsets from left to right in visual order.
Declaration
func enumerateCaretOffsetsInLineFragment(at location: any NSTextLocation, using block: (CGFloat, any NSTextLocation, Bool, UnsafeMutablePointer<ObjCBool>) -> Void)Parameters
- location:
The
NSTextLocationto start from. - block:
The closure to invoke once for each logical caret edge in the line fragment, in left-to-right visual order. End the enumeration early by returning
false.
Discussion
The caretOffset is in the coordinate system for the text container. When leadingEdge is true, it indicates that caretOffset is at the logical edge preceding the character. For left-to-right characters, the caret is on the left, and on the right for right-to-left characters.