---
title: "CFTreePrependChild(_:_:)"
framework: Core Foundation
role: symbol
role_heading: Function
path: "corefoundation/cftreeprependchild(_:_:)"
---

# CFTreePrependChild(_:_:)

Adds a new child to the specified tree as the first in its list of children.

## Declaration

```swift
func CFTreePrependChild(_ tree: CFTree!, _ newChild: CFTree!)
```

## Parameters

- `tree`: The tree to which to add newChild.
- `newChild`: The child tree to add to tree. This value must not be a child of another tree.

## Discussion

Discussion When a child tree is added to another tree, the child tree is retained by its new parent.

## See Also

### Modifying a Tree

- [CFTreeAppendChild(_:_:)](corefoundation/cftreeappendchild(_:_:).md)
- [CFTreeInsertSibling(_:_:)](corefoundation/cftreeinsertsibling(_:_:).md)
- [CFTreeRemoveAllChildren(_:)](corefoundation/cftreeremoveallchildren(_:).md)
- [CFTreeRemove(_:)](corefoundation/cftreeremove(_:).md)
- [CFTreeSetContext(_:_:)](corefoundation/cftreesetcontext(_:_:).md)
