Methods your app can implement to respond to layer-related events.


protocol CALayerDelegate


You can implement the methods of this protocol to provide the layer’s content, handle the layout of sublayers, and provide custom animation actions to perform. The object that implements this protocol must be assigned to the delegate property of the layer object.


Providing the Layer's Content

func display(CALayer)

Tells the delegate to implement the display process.

func draw(CALayer, in: CGContext)

Tells the delegate to implement the display process using the layer's CGContext.

func layerWillDraw(CALayer)

Notifies the delegate of an imminent draw.

Laying Out Sublayers

func layoutSublayers(of: CALayer)

Tells the delegate a layer's bounds have changed.

Providing a Layer's Actions


Inherits From

Conforming Types

See Also

Layer Basics

class CALayer

An object that manages image-based content and allows you to perform animations on that content.

class CAConstraint

A representation of a single layout constraint between two layers.

protocol CALayoutManager

Methods that allow an object to manage the layout of a layer and its sublayers.

class CAConstraintLayoutManager

An object that provides a constraint-based layout manager.

protocol CAAction

An interface that allows objects to respond to actions triggered by a CALayer change.