add(_:completionHandler:)
Adds an array of songs to the user’s Shazam library.
Declaration
func add(_ mediaItems: [SHMediaItem], completionHandler: @escaping @Sendable ((any Error)?) -> Void)func add(_ mediaItems: [SHMediaItem]) async throwsParameters
- mediaItems:
An array of media items that represents the songs to add to the library.
- completionHandler:
The system calls this completion block after adding the media items to the library.
This block takes the following parameters:
errorAn error object if a problem occurs when adding any item; otherwise,
nil.
Discussion
Saving a song to the user’s Shazam library also saves the following media item properties and their associated values: