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

# addChild(_:)

Adds a child node after the last of the receiver’s existing children.

## Declaration

```swift
func addChild(_ child: XMLNode)
```

## Parameters

- `child`: The doc://com.apple.foundation/documentation/Foundation/XMLNode object to be added.

## See Also

### Adding and Removing Child Nodes

- [insertChild(_:at:)](foundation/xmldocument/insertchild(_:at:).md)
- [insertChildren(_:at:)](foundation/xmldocument/insertchildren(_:at:).md)
- [removeChild(at:)](foundation/xmldocument/removechild(at:).md)
- [replaceChild(at:with:)](foundation/xmldocument/replacechild(at:with:).md)
- [setChildren(_:)](foundation/xmldocument/setchildren(_:).md)
