---
title: "insertChildNode(_:at:)"
framework: scenekit
role: symbol
role_heading: Instance Method
path: "scenekit/scnnode/insertchildnode(_:at:)"
---

# insertChildNode(_:at:)

Adds a node to the node’s array of children at a specified index.

## Declaration

```swift
func insertChildNode(_ child: SCNNode, at index: Int)
```

## Parameters

- `child`: The node to be inserted. important: Raises an exception (doc://com.apple.documentation/documentation/Foundation/NSExceptionName/invalidArgumentException) if child is nil.
- `index`: The position at which to insert the new child node. important: Raises an exception (doc://com.apple.documentation/documentation/Foundation/NSExceptionName/rangeException) if index is greater than the number of elements in the node’s doc://com.apple.scenekit/documentation/SceneKit/SCNNode/childNodes array.

## See Also

### Managing the Node Hierarchy

- [parent](scenekit/scnnode/parent.md)
- [childNodes](scenekit/scnnode/childnodes.md)
- [addChildNode(_:)](scenekit/scnnode/addchildnode(_:).md)
- [removeFromParentNode()](scenekit/scnnode/removefromparentnode().md)
- [replaceChildNode(_:with:)](scenekit/scnnode/replacechildnode(_:with:).md)
