Contents

characterIndex(for:)

Returns the index of the character whose bounding rectangle includes the given point.

Declaration

func characterIndex(for point: NSPoint) -> Int

Parameters

  • point:

    The point to test, in screen coordinates.

Return Value

The character index, measured from the start of the receiver’s text storage, of the character containing the given point. Returns NSNotFound if the cursor is not within a character’s bounding rectangle.

See Also

Getting character coordinates