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

# textViewportLayoutController(_:retrieveCachedRenderingSurfaceFor:)

Asks the delegate to return a previously cached rendering surface.

```
optional func textViewportLayoutController(_ textViewportLayoutController: NSTextViewportLayoutController, retrieveCachedRenderingSurfaceFor renderingSurfaceKey: any NSTextViewportRenderingSurfaceKey) -> any NSTextViewportRenderingSurface
```

## Parameters

`textViewportLayoutController`

The viewport layout controller.

`renderingSurfaceKey`

The key identifying the rendering surface.

## Return Value

The cached rendering surface, 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)