<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextSelectionManager/Delegate-swift.protocol/selectionManager(_:locationOfTextContainerAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextSelectionManagerDelegate(im)selectionManager:locationOfTextContainerAtPoint:"
  },
  "title" : "selectionManager(_:locationOfTextContainerAt:)"
}
-->

# selectionManager(_:locationOfTextContainerAt:)

Returns the text location of the text container at the specified point.

```
optional func selectionManager(_ selectionManager: NSTextSelectionManager, locationOfTextContainerAt point: NSPoint) -> (any NSTextLocation)?
```

## Parameters

`selectionManager`

The selection manager requesting the text location.

`point`

The point in the view’s coordinate system.

## Return Value

The text location for the text container at the point, or `nil` if no container exists there.

## Discussion

Implement this method when your view hosts multiple text containers, such as multi-column or paginated layouts, so the selection manager can identify which container a gesture targets. Also implement `selectionManager:frameOfTextContainerAtPoint:` so the selection manager can convert gesture points into the correct container’s local coordinates.

---

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)