The documentation to the NSTextSelectionDataSource.enumerateCaretOffsetsInLineFragmentAtLocation:usingBlock
regarding location
parameter is not correct.
Online version https://developer.apple.com/documentation/uikit/nstextselectiondatasource/enumeratecaretoffsetsinlinefragment(at:using:)?language=objc
Documentations says: location - The NSTextLocation to start from.
however it is not where the enumeration starts. It is the location used to determine which line fragment to enumerate. The enumeration start from the line fragment location instead.