offset(from:to:)
Returns the offset between the two specified locations.
Declaration
optional func offset(from: any NSTextLocation, to: any NSTextLocation) -> IntParameters
- from:
A starting location.
- to:
An ending location.
Return Value
An Integer that represents the offset between the starting and ending locations.
Discussion
The return value could be positive or negative. This method can return NSNotFound when the method can’t represent an offset as an integer value. This can occur, for example, if the locations aren’t in the same document).