---
title: "position(within:farthestIn:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextinput/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.

## Declaration

```swift
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

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

## See Also

### Determining layout and writing direction

- [characterRange(byExtending:in:)](uikit/uitextinput/characterrange(byextending:in:).md)
- [baseWritingDirection(for:in:)](uikit/uitextinput/basewritingdirection(for:in:).md)
- [setBaseWritingDirection(_:for:)](uikit/uitextinput/setbasewritingdirection(_:for:).md)
