---
title: "generateSignature(from:completionHandler:)"
framework: shazamkit
role: symbol
role_heading: Type Method
path: "shazamkit/shsignaturegenerator/generatesignature(from:completionhandler:)"
---

# generateSignature(from:completionHandler:)

Creates a signature with the asset you specify.

## Declaration

```swift
class func generateSignature(from asset: AVAsset, completionHandler: @escaping @Sendable (SHSignature?, (any Error)?) -> Void)
```

```swift
class func signature(from asset: AVAsset) async throws -> SHSignature
```

## Parameters

- `asset`: An asset that contains the audio to convert.
- `completionHandler`: The system calls this completion block after creating the signature, or an error if the system couldn’t create it. This block takes the following parameters:

## Discussion

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: class func signature(from asset: AVAsset) async throws -> SHSignature For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously. The asset you specify can be any type of media that contains audio tracks. If the asset has multiple tracks, the system mixes them into one SHSignature.
