<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKNode",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SKNode"
  },
  "title" : "SKNode"
}
-->

# SKNode

The base class of all SpriteKit nodes.

```
@MainActor class SKNode
```

## Overview

`SKNode` provides base properties for its subclasses and it can be used as a container or layout tool for other nodes. For example, you might add a collection of nodes as children to an `SKNode` that all move together within the scene; because nodes inherit the properties of their parent, changing the parent node’s [`position`](/documentation/SpriteKit/SKNode/position) propagates the change to its children as well.

`SKNode` does not draw any content itself. Its visual counterparts are listed in Nodes that Draw in [Nodes for Scene Building](/documentation/SpriteKit/nodes-for-scene-building).

## Topics

### First Steps

[Getting Started with Nodes](/documentation/SpriteKit/getting-started-with-nodes)

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

[`init()`](/documentation/SpriteKit/SKNode/init())

Initializes a blank node.

[`node`](/documentation/SpriteKit/SKNode/node)

Creates a new node.

[`init(fileNamed:)`](/documentation/SpriteKit/SKNode/init(fileNamed:))

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

[`init(coder:)`](/documentation/SpriteKit/SKNode/init(coder:))

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

[`init(fileNamed:securelyWithClasses:)`](/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:))

### Positioning Content in a Scene

Lay out content in a scene by positioning it within its parent’s coordinate system.

[`position`](/documentation/SpriteKit/SKNode/position)

The position of the node in its parent’s coordinate system.

### Querying the Content Size

Read the location and size of a node or its children in the parent’s coordinate space.

[`frame`](/documentation/SpriteKit/SKNode/frame)

A rectangle in the parent’s coordinate system that contains the node’s content, ignoring the node’s children.

[`calculateAccumulatedFrame()`](/documentation/SpriteKit/SKNode/calculateAccumulatedFrame())

Returns a rectangle in the parent’s coordinate system that contains the position and size of itself and all child nodes.

### Configuring Draw Order

[About Node Drawing Order](/documentation/SpriteKit/about-node-drawing-order)

Understand how SpriteKit layers your scene’s nodes from top to bottom.

[`zPosition`](/documentation/SpriteKit/SKNode/zPosition)

The height of the node relative to its parent.

### Scaling and Rotating

[`zRotation`](/documentation/SpriteKit/SKNode/zRotation)

The Euler rotation about the z axis (in radians).

[`setScale(_:)`](/documentation/SpriteKit/SKNode/setScale(_:))

Sets the [`xScale`](/documentation/SpriteKit/SKNode/xScale) and [`yScale`](/documentation/SpriteKit/SKNode/yScale) properties of the node.

[`xScale`](/documentation/SpriteKit/SKNode/xScale)

A scaling factor that multiplies the width of a node and its children.

[`yScale`](/documentation/SpriteKit/SKNode/yScale)

A scaling factor that multiplies the height of a node and its children.

### Accessing Related Nodes

[About SpriteKit Coordinate Systems](/documentation/SpriteKit/about-spritekit-coordinate-systems)

Learn how a node conforms to its coordinate systems.

[`scene`](/documentation/SpriteKit/SKNode/scene)

The scene node that contains this node.

[`parent`](/documentation/SpriteKit/SKNode/parent)

The node’s parent node.

[`children`](/documentation/SpriteKit/SKNode/children)

The node’s children.

### Modifying the Node Tree

[Accessing and Modifying the Node Tree](/documentation/SpriteKit/accessing-and-modifying-the-node-tree)

See the objects and functions you use to control the node tree’s composition.

[`addChild(_:)`](/documentation/SpriteKit/SKNode/addChild(_:))

Adds a node to the end of the receiver’s list of child nodes.

[`insertChild(_:at:)`](/documentation/SpriteKit/SKNode/insertChild(_:at:))

Inserts a node into a specific position in the receiver’s list of child nodes.

[`isEqual(to:)`](/documentation/SpriteKit/SKNode/isEqual(to:))

Compares the parameter node to the receiving node.

[`move(toParent:)`](/documentation/SpriteKit/SKNode/move(toParent:))

Moves the node to a new parent node in the scene.

[`removeFromParent()`](/documentation/SpriteKit/SKNode/removeFromParent())

Removes the receiving node from its parent.

[`removeAllChildren()`](/documentation/SpriteKit/SKNode/removeAllChildren())

Removes all of the node’s children.

[`removeChildren(in:)`](/documentation/SpriteKit/SKNode/removeChildren(in:))

Removes a list of children from the receiving node.

[`inParentHierarchy(_:)`](/documentation/SpriteKit/SKNode/inParentHierarchy(_:))

Returns a Boolean value that indicates whether the node is a descendant of the target node.

### Customizing Nodes

[Customizing the Behavior of a Node](/documentation/SpriteKit/customizing-the-behavior-of-a-node)

Organize your app’s logic and display code with nodes.

### Propagating Properties to Children

[About Node Property Propagation](/documentation/SpriteKit/about-node-property-propagation)

Learn which properties of a node affect its child nodes.

### Accessing Nodes by Name

Access nodes by name instead of instance properties.

[Searching the Node Tree](/documentation/SpriteKit/searching-the-node-tree)

Access nodes by name to avoid needing an instance variable.

[`name`](/documentation/SpriteKit/SKNode/name)

The node’s assignable name.

[`childNode(withName:)`](/documentation/SpriteKit/SKNode/childNode(withName:))

Searches the children of the receiving node for a node with a specific name.

[`enumerateChildNodes(withName:using:)`](/documentation/SpriteKit/SKNode/enumerateChildNodes(withName:using:))

Searches the children of the receiving node to perform processing for nodes that share a name.

[`subscript(_:)`](/documentation/SpriteKit/SKNode/subscript(_:))

Returns an array of nodes that match the name parameter.

### Altering Node Visibility

Control whether a node is visible or semitransparent.

[`alpha`](/documentation/SpriteKit/SKNode/alpha)

The transparency value applied to the node’s contents.

[`isHidden`](/documentation/SpriteKit/SKNode/isHidden)

A Boolean value that determines whether a node and its descendants are rendered.

### Running Actions

Run actions on a node and control their timing.

[Getting Started with Actions](/documentation/SpriteKit/getting-started-with-actions)

Create, configure, and run actions in SpriteKit.

[`run(_:)`](/documentation/SpriteKit/SKNode/run(_:))

Adds an action to the list of actions executed by the node.

[`run(_:completion:)`](/documentation/SpriteKit/SKNode/run(_:completion:))

Adds an action to the list of actions executed by the node and schedules the argument block to be run upon completion of the action.

[`run(_:withKey:)`](/documentation/SpriteKit/SKNode/run(_:withKey:))

Adds an identifiable action to the list of actions executed by the node.

[`speed`](/documentation/SpriteKit/SKNode/speed)

A speed modifier applied to all actions executed by a node and its descendants.

[`isPaused`](/documentation/SpriteKit/SKNode/isPaused)

A Boolean value that determines whether actions on the node and its descendants are processed.

[`action(forKey:)`](/documentation/SpriteKit/SKNode/action(forKey:))

Returns an action associated with a specific key.

[`hasActions()`](/documentation/SpriteKit/SKNode/hasActions())

Returns a Boolean value that indicates whether the node is executing actions.

[`removeAllActions()`](/documentation/SpriteKit/SKNode/removeAllActions())

Ends and removes all actions from the node.

[`removeAction(forKey:)`](/documentation/SpriteKit/SKNode/removeAction(forKey:))

Removes an action associated with a specific key.

### Adding Physics Behaviors

Enable physics behaviors by adding a body.

[Getting Started with Physics Bodies](/documentation/SpriteKit/getting-started-with-physics-bodies)

Create and assign a physics body to enable physics.

[`physicsBody`](/documentation/SpriteKit/SKNode/physicsBody)

The physics body associated with the node.

### Constraining Node Position or Rotation

Define positional contraints relating to other nodes in the scene.

[`constraints`](/documentation/SpriteKit/SKNode/constraints)

A list of constraints to apply to the node.

[`reachConstraints`](/documentation/SpriteKit/SKNode/reachConstraints)

The reach constraints to apply to the node when executing a reach action.

### Detecting Collisions Manually

As an alternative to [`SKPhysicsContactDelegate`](/documentation/SpriteKit/SKPhysicsContactDelegate)

Methods your app can implement to respond when physics bodies come into contact., manually check if two nodes overlap.

[`intersects(_:)`](/documentation/SpriteKit/SKNode/intersects(_:))

Returns a Boolean value that indicates whether this node intersects the specified node.

### Adding GameplayKit Behaviors

Enable GameplayKit behaviors by defining an entity and its obstacles in a scene.

[`entity`](/documentation/SpriteKit/SKNode/entity)

The GameplayKit entity this node represents.

[`obstacles(fromNodeBounds:)`](/documentation/SpriteKit/SKNode/obstacles(fromNodeBounds:))

Converts each node into an obstacle by transforming its bounds into the scene’s coordinate system.

[`obstacles(fromNodePhysicsBodies:)`](/documentation/SpriteKit/SKNode/obstacles(fromNodePhysicsBodies:))

Converts each node into an obstacle by transforming the node’s physics body shape into the scene’s coordinate system.

[`obstacles(fromSpriteTextures:accuracy:)`](/documentation/SpriteKit/SKNode/obstacles(fromSpriteTextures:accuracy:))

Turns each node into an obstacle by changing the node’s texture into a physics shape and converting it into the scene’s coordinate system.

### Handling User Input

Enable user interaction to allow a node to respond to user input.

[Controlling User Interaction on Nodes](/documentation/SpriteKit/controlling-user-interaction-on-nodes)

Enable your node to respond to user input, like touches or mouse clicks.

[`isUserInteractionEnabled`](/documentation/SpriteKit/SKNode/isUserInteractionEnabled)

A Boolean value that indicates whether the node receives touch events.

[`focusBehavior`](/documentation/SpriteKit/SKNode/focusBehavior)

The focus behavior for a node.

### Hit Testing

[Understanding Hit-Testing](/documentation/SpriteKit/understanding-hit-testing)

Learn how find child nodes at a given point by using hit-testing.

[`contains(_:)`](/documentation/SpriteKit/SKNode/contains(_:))

Returns a Boolean value that indicates whether a point lies inside the parent’s coordinate system.

[`atPoint(_:)`](/documentation/SpriteKit/SKNode/atPoint(_:))

Returns the deepest visible descendant that intersects a point.

[`nodes(at:)`](/documentation/SpriteKit/SKNode/nodes(at:))

Returns an array of all visible descendants that intersect a point.

### Converting Between Coordinate Systems of Different Nodes

[Converting Coordinate Spaces](/documentation/SpriteKit/converting-coordinate-spaces)

Convert positions across the various coordinate spaces in a scene.

[`convert(_:from:)`](/documentation/SpriteKit/SKNode/convert(_:from:))

Converts a point from the coordinate system of another node in the node tree to the coordinate system of this node.

[`convert(_:to:)`](/documentation/SpriteKit/SKNode/convert(_:to:))

Converts a point in this node’s coordinate system to the coordinate system of another node in the node tree.

### Adding Custom Data Without Subclassing

Quickly add data to a node without having to subclass it.

[`userData`](/documentation/SpriteKit/SKNode/userData)

A dictionary containing arbitrary data.

### Providing Accessibility

Extend your app’s usability by exposing certain nodes in your scene as Accessibility user interface elements.

[`accessibilityChildren`](/documentation/SpriteKit/SKNode/accessibilityChildren)

An array of user interface elements that represent children of this element.

[`accessibilityFrame`](/documentation/SpriteKit/SKNode/accessibilityFrame)

The size of this user interface element, in screen points.

[`accessibilityHelp`](/documentation/SpriteKit/SKNode/accessibilityHelp)

The help description of this user interface element; for example, the text shown in a tooltip.

[`accessibilityLabel`](/documentation/SpriteKit/SKNode/accessibilityLabel)

A short description of this user interface element.

[`accessibilityParent`](/documentation/SpriteKit/SKNode/accessibilityParent)

The user interface element that contains this element.

[`accessibilityRole`](/documentation/SpriteKit/SKNode/accessibilityRole)

A string value describing the user interface element type; for example, a button.

[`accessibilityRoleDescription`](/documentation/SpriteKit/SKNode/accessibilityRoleDescription)

A string value describing the user interface element name and type; for example, the Buy button.

[`accessibilitySubrole`](/documentation/SpriteKit/SKNode/accessibilitySubrole)

A string that defines this user interface element’s subrole; for example, a full-screen button.

[`isAccessibilityElement`](/documentation/SpriteKit/SKNode/isAccessibilityElement)

A toggle you implement to indicate to the system whether this user interface element should be exposed to the user.

[`isAccessibilityEnabled`](/documentation/SpriteKit/SKNode/isAccessibilityEnabled)

A toggle you implement to indicate to the system whether this user interface element should respond to user input.

[`accessibilityHitTest(_:)`](/documentation/SpriteKit/SKNode/accessibilityHitTest(_:))

Returns the frontmost user interface element in the element hierarchy.

### Setting a Node’s Unique Attributes for a Shader

Set the values that make a node unique to a shader.

[`attributeValues`](/documentation/SpriteKit/SKNode/attributeValues)

The values of each attribute associated with the node’s attached shader.

[`setValue(_:forAttribute:)`](/documentation/SpriteKit/SKNode/setValue(_:forAttribute:))

Sets an attribute value for an attached shader

[`value(forAttributeNamed:)`](/documentation/SpriteKit/SKNode/value(forAttributeNamed:))

The value of a shader attribute.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)