location(_:offsetBy:)
Returns a new location using the location and offset you specify.
Declaration
func location(_ location: any NSTextLocation, offsetBy offset: Int) -> (any NSTextLocation)?Parameters
- location:
The starting location in the selection.
- offset:
An offset that describes the extent of the new location.
Return Value
A new NSTextLocation, or nil when the inputs don’t produce any legal location, such as when the input is an out of bounds index.
Discussion
The offset value can be positive or negative indicating the logical direction.