A visual WatchKit element that displays a SpriteKit scene.


class WKInterfaceSKScene : WKInterfaceObject


Present a scene by calling the interface’s presentScene(_:) or presentScene(_:transition:) method and passing in a SKScene object. When a scene is presented, it alternates between running its simulation (which animates the content) and rendering the content for display. You can pause the scene by setting the interface’s isPaused property to true.

Do not subclass or create instances of this class yourself. Instead, drag a SpriteKit Scene object from your Object Library and add it to your storyboard. Then define an outlet in your interface controller class and connect it to the SpriteKit Scene object. For example, to refer to a scene object in your interface, define a property with the following syntax in your interface controller class:

@IBOutlet weak var sceneInterface: WKInterfaceSKScene!

During the initialization of your interface controller, WatchKit creates a new instance of this class and assigns it to your outlet. At that point, you can use the object in your outlet to make changes to the SpriteKit scene.

The SpriteKit scene in your Watch app must be connected to a WKInterfaceSKScene outlet in your WatchKit extension for the scene to be visible in your watchOS app's user interface.


Displaying a Scene

Define the content displayed by this watch interface.

var scene: SKScene?

The currently presented SpriteKit scene.

func presentScene(SKScene, transition: SKTransition)

Transitions from the current scene to a new scene.

Configuring the Scene in a Storyboard

Adjust the Storyboard to set up your watch interface.

Controlling the Timing of a Scene's Rendering

Define the display link callback frequency or pause callbacks entirely.

var preferredFramesPerSecond: Int

The animation frame rate that the interface uses to render its scene.

var isPaused: Bool

A Boolean value that determines whether the view’s scene animations are paused.

Snapshotting Nodes to a Texture

Create a snapshot of a transformed node or portion of the node tree.

func texture(from: SKNode) -> SKTexture?

Renders the contents of a node tree and returns the rendered image as a SpriteKit texture.

func texture(from: SKNode, crop: CGRect) -> SKTexture?

Renders a portion of a node’s contents and returns the rendered image as a SpriteKit texture.

Initializing for SwiftUI


Creates a SpriteKit scene for use in SwiftUI.


Inherits From

Conforms To

See Also

Graphics and Games

class WKInterfaceSCNScene

An object that lets you manage SceneKit content for display in your app.