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

# position(from:offset:)

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

## Declaration

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

## Parameters

- `position`: A custom doc://com.apple.uikit/documentation/UIKit/UITextPosition object that represents a location in a document.
- `offset`: A character offset from position. It can be a positive or negative value.

## Return Value

Return Value A custom UITextPosition object that represents the location in a document that is at the specified offset from position. Return nil if the computed text position is less than 0 or greater than the length of the backing string.

## Discussion

Discussion For an example of an implementation of this method, 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:in:offset:)](uikit/uitextinput/position(from:in:offset:).md)
- [beginningOfDocument](uikit/uitextinput/beginningofdocument.md)
- [endOfDocument](uikit/uitextinput/endofdocument.md)
