Protocol

SKSceneDelegate

Methods that, when implemented, allow any class to participate in the SpriteKit render loop callbacks.

Declaration

@protocol SKSceneDelegate

Overview

The SKSceneDelegate protocol is used to implement a delegate to be called whenever the scene is being animated. Typically, you supply a delegate when you want to use a scene without requiring the scene to be subclassed. The methods in this protocol all correspond to methods implemented by the SKScene class. If the delegate implements a particular method, that method is called instead of the corresponding method on the scene object.

When processing a scene, SpriteKit runs a loop that processes and renders the scene. The SKSceneDelegate methods allows you to add logic at any step of the loop.

Figure 1

Frame processing in a scene

Frame processing in a scene

Topics

Handling Animation Events

Use SpriteKit Objects within Scene Delegate Callbacks

Follow threading guidelines to keep your SpriteKit app thread safe.

- update:forScene:

Tells you to perform any app specific logic to update your scene.

- didEvaluateActionsForScene:

Tells you to peform any necessary logic after scene actions are evaluated.

- didSimulatePhysicsForScene:

Tells you to peform any necessary logic after physics simulations are performed.

- didApplyConstraintsForScene:

Tells you to peform any necessary logic after constraints are applied.

- didFinishUpdateForScene:

Tells you to peform any necessary logic after the scene has finished all of the steps required to process animations.

Relationships

Inherits From

See Also

Configuring a Delegate

Subclassing Scenes Versus Assigning a Delegate

Use a scene delegate to share app logic across various scenes.

delegate

A delegate to be called during the animation loop.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software