<!--
{
  "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/position(within:farthestIn:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITextInput(im)positionWithinRange:farthestInDirection:"
  },
  "title" : "position(within:farthestIn:)"
}
-->

# position(within:farthestIn:)

Returns the text position that is at the farthest extent in a specified layout direction within a range of text.

```
func position(within range: UITextRange, farthestIn direction: UITextLayoutDirection) -> UITextPosition?
```

## Parameters

`range`

A text-range object that demarcates a range of text in a document.

`direction`

A constant that indicates a direction of layout (right, left, up, down).

## Return Value

A text-position object that identifies a location in the visible text.

## 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)