---
title: "position(from:in:offset:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextinput/position(from:in:offset:)"
---

# position(from:in:offset:)

Returns the text position at a specified offset in a specified direction from another text position.

## Declaration

```swift
func position(from position: UITextPosition, in direction: UITextLayoutDirection, offset: Int) -> UITextPosition?
```

## Parameters

- `position`: A custom doc://com.apple.uikit/documentation/UIKit/UITextPosition object that represents a location in a document.
- `direction`: A doc://com.apple.uikit/documentation/UIKit/UITextLayoutDirection constant that represents the direction of the offset from position. Return nil if the computed text position is less than 0 or greater than the length of the backing string.
- `offset`: A character offset from position.

## Discussion

Discussion For an example of an implementation of the related method, position(from:offset:), see Using Text Kit to Draw and Manage Text in Text Programming Guide for iOS.

## See Also

### Computing text ranges and text positions

- [textRange(from:to:)](uikit/uitextinput/textrange(from:to:).md)
- [position(from:offset:)](uikit/uitextinput/position(from:offset:).md)
- [beginningOfDocument](uikit/uitextinput/beginningofdocument.md)
- [endOfDocument](uikit/uitextinput/endofdocument.md)
