<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/NSTextLayoutManagerDelegate/textLayoutManager(_:retrieveCachedTextAttachmentViewProviderFor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextLayoutManagerDelegate(im)textLayoutManager:retrieveCachedTextAttachmentViewProviderForTextAttachment:"
  },
  "title" : "textLayoutManager(_:retrieveCachedTextAttachmentViewProviderFor:)"
}
-->

# textLayoutManager(_:retrieveCachedTextAttachmentViewProviderFor:)

Returns a cached `NSTextAttachmentViewProvider` to be associated with a particular attachment.

```
optional func textLayoutManager(_ textLayoutManager: NSTextLayoutManager, retrieveCachedTextAttachmentViewProviderFor attachment: NSTextAttachment) -> NSTextAttachmentViewProvider?
```

## Parameters

`textLayoutManager`

The text layout manager sending the message.

`attachment`

The attachment to retrieve a cached view provider for.

## Return Value

A previously cached view provider, or `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)