Contents

NSTextViewportRenderingSurfaceKey

A protocol that lets you use an object to identify a rendering surface when storing or retrieving it.

Declaration

protocol NSTextViewportRenderingSurfaceKey : NSObjectProtocol

Overview

When TextKit lays out text in a viewport, it can ask your delegate to store and retrieve rendering surfaces across layout passes. Objects that conform to NSTextViewportRenderingSurfaceKey act as the identifier for each surface — TextKit passes them to your delegate when it needs to store or look one up.

Two types conform to this protocol by default:

  • NSTextLayoutFragment — Use a layout fragment as a key to cache a rendering surface per fragment. This is the most common approach.

  • NSString — Use a string as a key when you want to associate a rendering surface with a name rather than a fragment.

See Also

Layout