---
title: "CFBundleCreate(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfbundlecreate(_:_:)"
---

# CFBundleCreate(_:_:)

Creates a CFBundle object.

## Declaration

```swift
func CFBundleCreate(_ allocator: CFAllocator!, _ bundleURL: CFURL!) -> CFBundle!
```

## Parameters

- `allocator`: The allocator to use to allocate memory for the new object. Pass NULL or doc://com.apple.corefoundation/documentation/CoreFoundation/kCFAllocatorDefault to use the current default allocator.
- `bundleURL`: The location of the bundle for which to create a CFBundle object.

## Return Value

Return Value A CFBundle object created from the bundle at bundleURL. Ownership follows the The Create Rule.

## Discussion

Discussion Returns NULL if there was a memory allocation problem. May return an existing CFBundle object with the reference count incremented. May return NULL if the bundle doesn’t exist at bundleURL (see Discussion). Discussion Once a bundle has been created, it is cached; the bundle cache is flushed only periodically. CFBundleCreate does not check that a cached bundle still exists in the filesystem. If a bundle is deleted from the filesystem, it is therefore possible for CFBundleCreate to return a cached bundle that has actually been deleted.

## See Also

### Creating and Accessing Bundles

- [CFBundleCreateBundlesFromDirectory(_:_:_:)](corefoundation/cfbundlecreatebundlesfromdirectory(_:_:_:).md)
- [CFBundleGetAllBundles()](corefoundation/cfbundlegetallbundles().md)
- [CFBundleGetBundleWithIdentifier(_:)](corefoundation/cfbundlegetbundlewithidentifier(_:).md)
- [CFBundleGetMainBundle()](corefoundation/cfbundlegetmainbundle().md)
