Instance Method

enumerateChildNodesUsingBlock:

Executes the specified block for each of the node’s child and descendant nodes.

Declaration

- (void)enumerateChildNodesUsingBlock:(void (^)(SCNNode *child, BOOL *stop))block;

Parameters

block

The block to apply to the node’s child and descendant nodes.

  • The block takes two parameters:

  • child

    The child node currently being evaluated.

    stop

    A reference to a Boolean value. Set *stop to YES in the block to abort further processing of the child node subtree.

Discussion

SceneKit uses a recursive preorder traversal to process the child node subtree—that is, the block runs for a node before it runs for each of the node’s children, and it processes all children of a node before processing any of that node’s sibling nodes.

See Also

Searching the Node Hierarchy

- childNodesPassingTest:

Returns all nodes in the node’s child node subtree that satisfy the test applied by a block.

- childNodeWithName:recursively:

Returns the first node in the node’s child node subtree with the specified name.

- enumerateHierarchyUsingBlock:

Executes the specified block for each of the node’s child and descendant nodes, as well as for the node itself.