lineFragmentRange(for:inContainerAt:)
Returns the range of the line fragment that contains the point you specify.
Declaration
func lineFragmentRange(for point: CGPoint, inContainerAt location: any NSTextLocation) -> NSTextRange?Parameters
- point:
The starting point that contains the line fragment, in the coordinate system of
location. - location:
The location of the line fragment.
Return Value
An NSTextRange that describes the location of the line fragment, or nil if the range isn’t found.