---
title: "CFArrayCreateCopy(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfarraycreatecopy(_:_:)"
---

# CFArrayCreateCopy(_:_:)

Creates a new immutable array with the values from another array.

## Declaration

```swift
func CFArrayCreateCopy(_ allocator: CFAllocator!, _ theArray: CFArray!) -> CFArray!
```

## Parameters

- `allocator`: The allocator to use to allocate memory for the new array and its storage for values. Pass NULL or doc://com.apple.corefoundation/documentation/CoreFoundation/kCFAllocatorDefault to use the current default allocator.
- `theArray`: The array to copy.

## Return Value

Return Value A new CFArray object that contains the same values as theArray. Ownership follows The Create Rule.

## Discussion

Discussion The pointer values from theArray are copied into the new array; the values are also retained by the new array. The count of the new array is the same as theArray. The new array uses the same callbacks as theArray.

## See Also

### Creating an Array

- [CFArrayCreate(_:_:_:_:)](corefoundation/cfarraycreate(_:_:_:_:).md)
