SKNode
The base class of all SpriteKit nodes.
Declaration
@MainActor class SKNodeclass SKNodeMentioned in
- Customizing the Behavior of a Node
- Accessing and Modifying the Node Tree
- Animate the Warping of a Sprite
- Connecting Bodies with Joints
- Controlling User Interaction on Nodes
- Detecting Changes at Each Step of an Animation
- Resizing a Sprite in Nine Parts
- Searching the Node Tree
- Using Base Nodes to Lay Out SpriteKit Content
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 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.
Topics
First Steps
Positioning Content in a Scene
Querying the Content Size
Configuring Draw Order
Scaling and Rotating
Accessing Related Nodes
Modifying the Node Tree
Accessing and Modifying the Node TreeaddChild(_:)insertChild(_:at:)isEqual(to:)move(toParent:)removeFromParent()removeAllChildren()removeChildren(in:)inParentHierarchy(_:)
Customizing Nodes
Propagating Properties to Children
Accessing Nodes by Name
Altering Node Visibility
Running Actions
Getting Started with Actionsrun(_:)run(_:completion:)run(_:withKey:)speedisPausedaction(forKey:)hasActions()removeAllActions()removeAction(forKey:)
Adding Physics Behaviors
Constraining Node Position or Rotation
Detecting Collisions Manually
Adding GameplayKit Behaviors
entityobstacles(fromNodeBounds:)obstacles(fromNodePhysicsBodies:)obstacles(fromSpriteTextures:accuracy:)
Handling User Input
Hit Testing
Converting Between Coordinate Systems of Different Nodes
Adding Custom Data Without Subclassing
Providing Accessibility
accessibilityChildrenaccessibilityFrameaccessibilityHelpaccessibilityLabelaccessibilityParentaccessibilityRoleaccessibilityRoleDescriptionaccessibilitySubroleisAccessibilityElementisAccessibilityEnabledaccessibilityHitTest(_:)