<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextContentManagerDelegate/textContentManager(_:textElementAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextContentManagerDelegate(im)textContentManager:textElementAtLocation:"
  },
  "title" : "textContentManager(_:textElementAt:)"
}
-->

# textContentManager(_:textElementAt:)

The method the framework calls to return the text element at a specific location.

```
optional func textContentManager(_ textContentManager: NSTextContentManager, textElementAt location: any NSTextLocation) -> NSTextElement?
```

## Parameters

`textContentManager`

The content manager.

`location`

The location of the element.

## Return Value

An [`NSTextElement`](/documentation/AppKit/NSTextElement).

## Discussion

When non-`nil`, `textContentManager` uses the text element you specify instead of creating one based on its standard mapping logic.

---

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)