When printing out an Album, the release date is included:
Album(
id: "1566393640",
title: "Aquatic - Single",
artistName: "Nora En Pure",
genreNames: [
"Dance",
"Music"
],
releaseDate: "2021-06-04",
isCompilation: false,
upc: "7640130765399"
)
But it is not mentioned as an instance property here and I cannot identify any way to access it in my project. How can I go about getting access to this attribute via MusicKit?
Thanks! :)
Post
Replies
Boosts
Views
Activity
Hello!
I am trying a basic MusicCatalogResourceRequest to pull in a particular Artist from Apple Music. When printing out the result, it only contains the id and name of the Artist;
ex :
Artist(id: "78011850", name: "deadmau5")
It is missing all of the instance properties as defined on the developer documentation.
This is the snippet I am using, is there something missing? I am trying to fetch the related albums, but it is always returning nil.
static func catalogAlbumsForArtistId(artistId: MusicItemID) async -> MusicItemCollection<MusicKit.Album>? {
do {
let artistRequest = MusicCatalogResourceRequest<MusicKit.Artist>(matching: \.id, equalTo: artistId)
let artistResponse = try await artistRequest.response()
if let artist = artistResponse.items.first {
print("artist")
return artist.albums
}
} catch {
print(error)
}
return nil
}
Thanks! :)