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

# textViewportLayoutController(_:cacheRenderingSurface:for:)

Asks the delegate to cache a rendering surface for later retrieval.

```
optional func textViewportLayoutController(_ textViewportLayoutController: NSTextViewportLayoutController, cacheRenderingSurface renderingSurface: any NSTextViewportRenderingSurface, for renderingSurfaceKey: any NSTextViewportRenderingSurfaceKey)
```

## Parameters

`textViewportLayoutController`

The viewport layout controller.

`renderingSurface`

The rendering surface to cache.

`renderingSurfaceKey`

The key identifying the rendering surface.

---

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)