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

# insertChild(_:at:)

Inserts the specified outline object at the specified index.

## Declaration

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

## Discussion

Discussion To build a PDF outline hierarchy, use this method to add child outline objects. Before you call this method on a PDFOutline object that already has a parent, you should retain the object and call removeFromParent() on it first.

## See Also

### Related Documentation

- [child(at:)](pdfkit/pdfoutline/child(at:).md)

### Changing an Outline Hierarchy

- [removeFromParent()](pdfkit/pdfoutline/removefromparent().md)
