<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextLayoutManagerDelegate/textLayoutManager(_:cacheTextAttachmentViewProvider:for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextLayoutManagerDelegate(im)textLayoutManager:cacheTextAttachmentViewProvider:forTextAttachment:"
  },
  "title" : "textLayoutManager(_:cacheTextAttachmentViewProvider:for:)"
}
-->

# textLayoutManager(_:cacheTextAttachmentViewProvider:for:)

Notifies the delegate that a view provider associated with a text attachment is about to be invalidated.

```
optional func textLayoutManager(_ textLayoutManager: NSTextLayoutManager, cacheTextAttachmentViewProvider viewProvider: NSTextAttachmentViewProvider, for textAttachment: NSTextAttachment)
```

## Parameters

`textLayoutManager`

The text layout manager sending the message.

`viewProvider`

The view provider being invalidated.

`textAttachment`

The attachment associated with the view provider.

## Discussion

The delegate can use this to cache the view provider.

---

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)