---
title: "adjustedRange(from:forEditingTextSelection:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextelementprovider/adjustedrange(from:foreditingtextselection:)"
---

# adjustedRange(from:forEditingTextSelection:)

A method you implement if the location backing store requires manual adjustment after editing.

## Declaration

```swift
optional func adjustedRange(from textRange: NSTextRange, forEditingTextSelection: Bool) -> NSTextRange?
```

## Parameters

- `textRange`: An doc://com.apple.appkit/documentation/AppKit/NSTextRange that the method adjusts.
- `forEditingTextSelection`: A Boolean value that indicates if textRange is for the text selection associated with the edit session.

## Return Value

Return Value When textRange is intersecting or following the current edited range, the method returns the range adjusted for the modification in the editing session. Returns nil, when no adjustment necessary.

## See Also

### Adjusting the range of the text element

- [offset(from:to:)](appkit/nstextelementprovider/offset(from:to:).md)
