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

# addChild(_:)

Adds a child node at the end of the receiver’s current list of children.

## Declaration

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

## Parameters

- `child`: An XML node object to add to the receiver’s children.

## Discussion

Discussion The new node has an index value that is one greater than the last of the current children.

## See Also

### Manipulating Child Elements

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