Instance Property


The height of the node relative to its parent.


var zPosition: CGFloat { get set }


The default value is 0.0. The positive z axis is projected toward the viewer so that nodes with larger z-position values are closer to the viewer. When a node tree is rendered, the height of each node (in absolute coordinates) is calculated and then all nodes in the tree are rendered from smallest z-position value to largest z-position value. If multiple nodes share the same z-position, those nodes are sorted so that parent nodes are drawn before their children, and siblings are rendered in the order that they appear in their parent’s children array. Hit-testing is processed in the opposite order.

The SKView class’s ignoresSiblingOrder property controls whether node sorting is enabled for nodes at the same z-position.

See Also

Inspecting the Node’s Position

func calculateAccumulatedFrame() -> CGRect

Calculates a rectangle in the parent’s coordinate system that contains the content of the node and all of its descendants.

var frame: CGRect

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

var position: CGPoint

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