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

# instantiate(with:options:completionHandler:)

Creates an instance of an audio unit component asynchronously and wraps it in an audio unit class.

## Declaration

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

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

## Parameters

- `audioComponentDescription`: The component to create.
- `options`: The options the method uses to create the component.
- `completionHandler`: A handler the framework calls in an arbitrary thread context when creation completes. Retain the doc://com.apple.avfaudio/documentation/AVFAudio/AVAudioUnit this handler provides.

## Discussion

Discussion You must create components with flags that include requiresAsyncInstantiation asynchronously through this method if they’re for use with AVAudioEngine. The AVAudioUnit instance is usually a subclass that the method selects according to the components type. For example, AVAudioUnitEffect, AVAudioUnitGenerator, AVAudioUnitMIDIInstrument, or AVAudioUnitTimeEffect.
