Contents

closestPosition(to:within:)

Returns the position in a document that is closest to a specified point in a specified range.

Declaration

func closestPosition(to point: CGPoint, within range: UITextRange) -> UITextPosition?

Parameters

  • point:

    A point in the view that is drawing a document’s text.

  • range:

    An object representing a range in a document’s text.

Return Value

An object representing the character position in range that is closest to point.

See Also

Working with geometry and hit-testing