A node that's defined in an archived .sks file.


class SKReferenceNode : SKNode


SKReferenceNode is used within an archived .sks file to refer to node defined in another .sks file without duplicating its definition. This way, a change to the referenced node propagates to all the references in other files.

As an example, you might want to share an enemy ship across two different levels, Scene1.sks and Scene2.sks, in a level-based game. Reference nodes allow you to do that without creating copies of the shared node and its properties.

To use a reference node:

  • Create the shared content in a separate archive

  • Add references to the shared archive within your scene archives

When each scene is loaded, the reference nodes are resolved dynamically, and therefore you only need to configure a shared object in one place.



init(url: URL)

Creates a reference node from a URL.

init(url: URL?)

Initializes a reference node from a URL.

init(fileNamed: String)

Creates a reference node from a file in the app’s main bundle.

init(fileNamed: String?)

Initializes a reference node from a file in the app’s main bundle.

init?(coder: NSCoder)

A method that initializes a reference node from an archive.


Load a reference nodes contents freshly from the archive again.

func resolve()

Loads the reference node’s content and adds it as a new child node.

Loading Callback

func didLoad(SKNode?)

A method called by SpriteKit after the reference node’s contents are loaded.

See Also

Base Nodes

Using Base Nodes to Lay Out SpriteKit Content

Use nonvisual nodes to define the layout of a scene.

class SKNode

The base class of all SpriteKit nodes.

class SKCameraNode

A node that determines which parts of the scene are visible within a view.