---
title: "position(within:atCharacterOffset:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextinput/position(within:atcharacteroffset:)"
---

# position(within:atCharacterOffset:)

Returns the position within a range of a document’s text that corresponds to the character offset from the start of that range.

## Declaration

```swift
optional func position(within range: UITextRange, atCharacterOffset offset: Int) -> UITextPosition?
```

## Parameters

- `range`: An object that specifies a range of text in a document.
- `offset`: A character offset from the start of range.

## Return Value

Return Value An object that represents a position in a document’s visible text.

## Discussion

Discussion You should implement this method if you don’t have a one-to-one correspondence between UITextPosition objects within the given range and character offsets into a document string.

## See Also

### Reconciling text position and character offset

- [characterOffset(of:within:)](uikit/uitextinput/characteroffset(of:within:).md)
