A visual WatchKit element that displays a SpriteKit scene.
- watchOS 3.0+
Present a scene by calling the interface’s
present 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
paused property to
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:
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
WKInterface outlet in your WatchKit extension for the scene to be visible in your watchOS app's user interface.