---
title: "childNodes(passingTest:)"
framework: scenekit
role: symbol
role_heading: Instance Method
path: "scenekit/scnnode/childnodes(passingtest:)"
---

# childNodes(passingTest:)

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

## Declaration

```swift
func childNodes(passingTest predicate: (SCNNode, UnsafeMutablePointer<ObjCBool>) -> Bool) -> [SCNNode]
```

## Parameters

- `predicate`: The block to apply to the node’s child and descendant nodes. The block takes two parameters: The block returns a Boolean value indicating whether to include the child node in the search results array.

## Return Value

Return Value An array containing nodes that passed the test.

## Discussion

Discussion Use this method to search for nodes using a test you specify. For example, you can search for empty nodes using a block that returns YES for nodes whose light, camera, and geometry properties are all nil. SceneKit uses a recursive preorder traversal to search the child node subtree—that is, the block searches a node before it searches each of the node’s children, and it searches all children of a node before searching any of that node’s sibling nodes.

## See Also

### Searching the Node Hierarchy

- [childNode(withName:recursively:)](scenekit/scnnode/childnode(withname:recursively:).md)
- [enumerateChildNodes(_:)](scenekit/scnnode/enumeratechildnodes(_:).md)
- [enumerateHierarchy(_:)](scenekit/scnnode/enumeratehierarchy(_:).md)
