Initializer

init(fileNamed:)

Creates a new node by loading an archive file from the game’s main bundle.

Declaration

convenience init?(fileNamed filename: String)

Parameters

filename

The name of the file, without a file extension. The file must be in the app’s main bundle and have a .sks filename extension.

Return Value

The unarchived node object.

Discussion

If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.

See Also

First Steps

Getting Started with Nodes

Learn about the fundamental properties that provide a foundation for all other nodes.

init()

Initializes a blank node.

init?(coder: NSCoder)

Called when a node is initialized from an .sks file.