<!--
{
  "availability" : [
    "iOS: 3.2.0 -",
    "iPadOS: 3.2.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextInput/closestPosition(to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITextInput(im)closestPositionToPoint:"
  },
  "title" : "closestPosition(to:)"
}
-->

# closestPosition(to:)

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

```
func closestPosition(to point: CGPoint) -> UITextPosition?
```

## Parameters

`point`

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

## Return Value

An object locating a position in a document that is closest to `point`.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)