<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/NSTextSelectionNavigation/resolvedInsertionLocation(for:writingDirection:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextSelectionNavigation(im)resolvedInsertionLocationForTextSelection:writingDirection:"
  },
  "title" : "resolvedInsertionLocation(for:writingDirection:)"
}
-->

# resolvedInsertionLocation(for:writingDirection:)

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

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

## Parameters

`textSelection`

The text selection.

`writingDirection`

The [`NSTextSelectionNavigation.WritingDirection`](/documentation/UIKit/NSTextSelectionNavigation/WritingDirection) direction.

## Return Value

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)