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

# CFTreeCreate(_:_:)

Creates a new CFTree object.

## Declaration

```swift
func CFTreeCreate(_ allocator: CFAllocator!, _ context: UnsafePointer<CFTreeContext>!) -> CFTree!
```

## Parameters

- `allocator`: The allocator to use to allocate memory for the new tree. Pass NULL or kCFAllocatorDefault to use the current default allocator.
- `context`: The doc://com.apple.corefoundation/documentation/CoreFoundation/CFTreeContext structure to be copied and used as the context of the new tree. The information pointer will be retained by the tree if a retain function is provided. If this value is not a valid C pointer to a doc://com.apple.corefoundation/documentation/CoreFoundation/CFTreeContext structure-sized block of storage, the result is undefined. If the version number of the storage is not a valid doc://com.apple.corefoundation/documentation/CoreFoundation/CFTreeContext version number, the result is undefined.

## Return Value

Return Value A new CFTree object. Ownership follows the The Create Rule.
