---
title: "instantiate(with:options:completionHandler:)"
framework: audiotoolbox
role: symbol
role_heading: Type Method
path: "audiotoolbox/auaudiounit/instantiate(with:options:completionhandler:)"
---

# instantiate(with:options:completionHandler:)

Asynchronously creates an audio unit instance.

## Declaration

```swift
class func instantiate(with componentDescription: AudioComponentDescription, options: AudioComponentInstantiationOptions = [], completionHandler: @escaping @Sendable (AUAudioUnit?, (any Error)?) -> Void)
```

```swift
class func instantiate(with componentDescription: AudioComponentDescription, options: AudioComponentInstantiationOptions = []) async throws -> AUAudioUnit
```

## Parameters

- `componentDescription`: The component to instantiate.
- `options`: Options for loading the unit in-process or out-of-process.
- `completionHandler`: The block called when instantiation has completed. The block parameters are defined as follows:

## Discussion

Discussion Certain types of audio units must be instantiated asynchronously, such as version 3 units with a view. note: Do not block the main thread while waiting for the completion handler to be called; this can deadlock.

## See Also

### Creating an Audio Unit

- [init(componentDescription:)](audiotoolbox/auaudiounit/init(componentdescription:).md)
- [init(componentDescription:options:)](audiotoolbox/auaudiounit/init(componentdescription:options:).md)
