<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PHASE",
  "identifier" : "/documentation/PHASE/PHASESoundEvent/prepare(completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "PHASE"
    ],
    "preciseIdentifier" : "c:objc(cs)PHASESoundEvent(im)prepareWithCompletion:"
  },
  "title" : "prepare(completion:)"
}
-->

# prepare(completion:)

Enables a sound event to play and runs the argument code when the sound event plays back.

```
func prepare(completion handler: (@Sendable (PHASESoundEvent.PrepareHandlerReason) -> Void)? = nil)
```

```
func prepare() async -> PHASESoundEvent.PrepareHandlerReason
```

## Parameters

`handler`

Code the framework runs when sound event preparation completes. If you pass `nil`, no code runs when preparation completes.

## Discussion

> Important:
> You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration:
> 
> ```swift
> func prepare() async -> PHASESoundEvent.PrepareHandlerReason
> ```
> 
> For information about concurrency and asynchronous code in Swift, see <doc://com.apple.documentation/documentation/Swift/calling-objective-c-apis-asynchronously>.

This function instructs the engine to prepare a sound event and returns immediately. When the preparation completes or fails, the framework runs `completionHandler`.

If you call [`start(completion:)`](/documentation/PHASE/PHASESoundEvent/start(completion:)) before `completionHandler` runs, the framework queues the sound event to occur when preparation completes.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)