A component that manages a SpriteKit node.


class GKSKNodeComponent : GKComponent


Adding a GKSKNodeComponent object to an entity automatically updates the entity property of the component’s SpriteKit node (an SKNode object) to point to that entity.

When you add entities and components to a node in the Xcode SpriteKit scene editor, Xcode automatically creates a GKSKNodeComponent object to manage the relationship between that SpriteKit node and the GKEntity object that node represents. Load the scene file with the GKScene class to access these entities and components.

For more information on Entity-Component architecture, read Entities and Components in GameplayKit Programming Guide.


Creating a SpriteKit Component

init(node: SKNode)

Initializes a component to manage the specified SpriteKit node.

Accessing the Component’s SpriteKit Node

var node: SKNode

The SpriteKit node managed by the component.


Inherits From

See Also

Xcode and SpriteKit Integration

class GKScene

A container for associating GameplayKit objects with a SpriteKit scene.

protocol GKSceneRootNodeType

Identifies scene classes from other frameworks that support embedded GameplayKit information.