A protocol that defines an optional CALayer delegate method for handling resolution changes.


Use this protocol to manage scale and contents for a layer hosted in a view. When a window changes its backing resolution, AppKit attempts to automatically update the contentsScale and contents of all CALayer objects in the window to match the new resolution. Layers backed by a view are updated automatically. Any layer whose contents property is set to an NSImage object is also updated automatically. Based on the NSImage object’s available representations, AppKit selects an appropriate bitmapped representation, or rasterizes a resolution-independent representation at the appropriate scale factor.

For all other layers, AppKit checks whether the layer has a delegate that implements this protocol. If so, AppKit asks the layer's delegate whether it should automatically update the contentsScale for that layer to match the new scale factor of the window.


Managing Layer Scale and Contents

func layer(CALayer, shouldInheritContentsScale: CGFloat, from: NSWindow)

Invoked when a resolution changes occurs for the window that hosts the layer.

See Also


class NSWindow

A window that an app displays on the screen.

class NSPanel

A special kind of window that typically performs a function that is auxiliary to the main window.

protocol NSWindowDelegate

A set of optional methods that a delegate of NSWindow can implement to respond to events, such as window resizing, moving, exposing, and minimizing.

Tabbed Windows

Support tabbed windows in your app.


A set of methods that supports window scripting for all scriptable Cocoa apps.