<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextAttachmentViewProvider/textAttachment",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextAttachmentViewProvider(py)textAttachment"
  },
  "title" : "textAttachment"
}
-->

# textAttachment

The text attachment for this view.

```
weak var textAttachment: NSTextAttachment? { get }
```

## Discussion

Specify the value of this property at initialization time using the [`init(textAttachment:parentView:textLayoutManager:location:)`](/documentation/AppKit/NSTextAttachmentViewProvider/init(textAttachment:parentView:textLayoutManager:location:)) initializer.

---

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)