I'm trying to construct what I would consider a tracklist of an Album from MusicKit for Swift, but the steps I've had to take don't feel right to me, so I feel like I am missing something. The thing is that I don't just want a bag of tracks, I want their order (trackNumber) AND what disc they're on (discNumber), if more than one disc.
At the moment, I can get to the tracks for the album with album.with([.tracks]) to get a (MusicItemCollection<Track>), but each Track DOES NOT have a discNumber. Which means, in multi disc Albums all the tracks are munged together.
To get to the discNumber's, I've had to get an equivalent Song using the same ID, which DOES contain the discNumber, as well as the trackNumber. But this collection is not connected to the Album strongly, so I've had to create a containing struct to hold both the Album (which contains Track's) and some separate Song's, making my data model slightly more complex.
(Note that you don't appear to be able to do album.with([.songs]) to skip getting to a Song via a Track.)
I can't get my head around this structure - what is the difference between a Track and a Song?
I would think that the difference is that a Track is a specific representation on a specific Album, and a Song is a more general representation that might be shared amongst more Album's (like compilations). But therefore, surely discNumber should actually be on the Track as it is specific to the Album, and arguably Song shouldn't even have trackNumber of it's own?
In any case, can anyone help with what is the quickest way to get get the trackNumber's and discNumbers' of each actual track on an Album (starting with an MusicItemID) please?
var songs = [Song]()
let detailedAlbum = try await album.with([.tracks])
if let tracks = detailedAlbum.tracks {
for track in tracks {
let resourceRequest = MusicCatalogResourceRequest<Song>(matching: \.id, equalTo: track.id)
async let resourceResponse = resourceRequest.response()
guard let song = try await resourceResponse.items.first else { break }
songs.append(song)
}
}
Post
Replies
Boosts
Views
Activity
I've set up a couple of domains (seemingly) successfully with iCloud+ Custom Domains. All the DNS entries are correct.
Now, when I attempt to add an email address I get the error "There was a problem with adding this email address. Please try again later."
This has been happening for over 24 hours. I'm not quite sure how to proceed - I know this is in Beta, but I keep reading how it is working for other people so its hard to think this is a general problem.
I'm adding entirely new domains so there is no chance that the email addresses are previously known by Apple / used for a previous AppleID.
Any ideas please?