---
title: "addChild(_:)"
framework: phase
role: symbol
role_heading: Instance Method
path: "phase/phaseobject/addchild(_:)"
---

# addChild(_:)

Adds the given object as a child.

## Declaration

```swift
func addChild(_ child: PHASEObject) throws
```

## Parameters

- `child`: The object to add to the doc://com.apple.phase/documentation/PHASE/PHASEObject/children array.

## Mentioned in

Playing sound from a location in a 3D scene

## Discussion

Discussion This function throws an error if child already has a different parent.

## See Also

### Managing the Hierarchy

- [children](phase/phaseobject/children.md)
- [parent](phase/phaseobject/parent.md)
- [removeChild(_:)](phase/phaseobject/removechild(_:).md)
- [removeChildren()](phase/phaseobject/removechildren().md)
