---
title: "resolvedInsertionLocation(for:writingDirection:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/nstextselectionnavigation/resolvedinsertionlocation(for:writingdirection:)"
---

# resolvedInsertionLocation(for:writingDirection:)

Returns the location for inserting the next input depending on the state of the current and secondary selections.

## Declaration

```swift
func resolvedInsertionLocation(for textSelection: NSTextSelection, writingDirection: NSTextSelectionNavigation.WritingDirection) -> (any NSTextLocation)?
```

## Parameters

- `textSelection`: The text selection.
- `writingDirection`: The doc://com.apple.uikit/documentation/UIKit/NSTextSelectionNavigation/WritingDirection direction.

## Return Value

Return Value Returns an NSTextLocation when the textSelection.isLogical = false AND secondarySelectionLocation != nil. Otherwise, returns nil.
