<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ShazamKit",
  "identifier" : "/documentation/ShazamKit/SHSignatureGenerator/generateSignature(from:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "ShazamKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SHSignatureGenerator(cm)generateSignatureFromAsset:completionHandler:"
  },
  "title" : "generateSignature(from:completionHandler:)"
}
-->

# generateSignature(from:completionHandler:)

Creates a signature with the asset you specify.

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

## 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:

- `signature`: A new signature instance.
- error: An error object if a problem occurs when creating thesignature; otherwise, `nil`.

## 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
> class func signature(from asset: AVAsset) async throws -> SHSignature
> ```
> 
> For information about concurrency and asynchronous code in Swift, see <doc://com.apple.documentation/documentation/Swift/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`](/documentation/ShazamKit/SHSignature).

---

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)