---
title: "insertChild(_:at:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/xmldtd/insertchild(_:at:)"
---

# insertChild(_:at:)

Inserts a child node in the receiver’s list of children at a specific location in the list.

## Declaration

```swift
func insertChild(_ child: XMLNode, at index: Int)
```

## Parameters

- `child`: An XML-node object that represents the child to insert.
- `index`: An integer identifying the location in the receiver’s list of children to insert child. The indices of subsequent children in the list are incremented by one.

## See Also

### Manipulating Child Nodes

- [addChild(_:)](foundation/xmldtd/addchild(_:).md)
- [insertChildren(_:at:)](foundation/xmldtd/insertchildren(_:at:).md)
- [removeChild(at:)](foundation/xmldtd/removechild(at:).md)
- [replaceChild(at:with:)](foundation/xmldtd/replacechild(at:with:).md)
- [setChildren(_:)](foundation/xmldtd/setchildren(_:).md)
