Swiftpack.co - rryam/MusadoraKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by rryam.
rryam/MusadoraKit v1.9.0
The ultimate companion to MusicKit.
⭐️ 81
🕓 11 hours ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/rryam/MusadoraKit.git", from: "v1.9.0")


The ultimate companion to MusicKit.

MusadoraKit Logo

Twitter Follow

MusadoraKit is a Swift framework that uses the latest MusicKit and Apple Music API, making it easy to integrate Apple Music into your app. It uses the new async/await pattern introduced in Swift 5.5. Currently, it is available for iOS 15.0+, macOS 12.0+, watchOS 8.0+ and tvOS 15.0+. There are new methods coming every month to support iOS 16, macOS 13, watchOS 9 and tvOS 16 features.

It goes well with my book on Exploring MusicKit and Apple Music API, as all the documentation and references are mentioned in the book. Otherwise, the code itself is well documented.

Also, join the Discord Community for discussing anything about MusadoraKit, the book "Exploring MusicKit", MusicKit or your favorite music!


You can support my open-source by buying my book, "Exploring MusicKit and Apple Music API" or by buying me a book!

Apps Using MusadoraKit

  • Musadora - Apple Music client focused on playlists
  • Musadora Labs - A companion app to explore MusicKit


To easily access the Apple Music Catalog, you can use pre-defined methods from MusadoraKit. The method are similar across the music items.

Example of working with fetching a catalog song by its identifier:

let song = try await MusadoraKit.catalogSong(id: "1613834314", with: [.albums])

Example of searching the catalog:

let searchResponse = try await MusadoraKit.catalogSearch(for: "weeknd", types: [Song.self, Artist.self])



While this is natively not available in MusicKit, you can fetch library resources using MusadoraKit that uses Apple Music API under the hood. The method are similar across the music items.

Example of fetching all library songs in alphabetical order:

let songs = try await MusadoraKit.librarySongs()

Example of searching the user's library:

let searchResponse = try await MusadoraKit.librarySearch(for: "hello", types: [Song.self])



You can take advantage of Apple's Music recommendation system and use it in your app. For example, to fetch the default recommendations:

let recommendations = try await MusadoraKit.recommendations()

guard let recommendation = recommendations.first else { return }



You can also fetch historial data from the user's library. For example, to get the recently played resources:

let recentlyPlayedItems = try await MusadoraKit.recentlyPlayed()

let recentlyPlayedAlbums: [Album] = recentlyPlayedItems.compactMap { item in
    guard case let .album(album) = item else { return nil }
    return album


To fetch multiple catalog music items by their identifiers in the same request. For example:

let request = MusicCatalogResourcesRequest(types: [.songs: ["1456313177"], .albums: ["1531125029", "1575203352"]])
let response = try await request.response()



To fetch multiple library music items by their identifiers in the same request. For example:

let request = MusicLibraryResourcesRequest(types: [.songs: ["i.pmzqzM0S2rl5N4L"], .playlists: ["p.PkxVBgps2zOdV3r"]])
let response = try await request.response()


I hope you love working with MusadoraKit!


Stars: 81
Last commit: 18 hours ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Version 1.9.0
18 hours ago

Add LibraryPlaylist and libraryPlaylists() method.

You can now directly fetch ALL playlists of a user in a single line:

let playlists = try await MusadoraKit.libraryPlaylists()

This method fetches the playlists from the user library. It is helpful when you are targeting iOS 15, and cannot use MusicLibraryRequest introduced in iOS 16, yet.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics