I'm building a SwiftUI music app that displays the "currently playing" song info based on ApplicationMusicPlayer.shared.queue.currentEntry. This is what the debug description looks like for currentEntry:
Optional(MusicPlayer.Queue.Entry(id: "4Nknkwlke∆wNEXFpkFF", item = Song(id: "1452351734", title: "Piano Sonata No. 14 in C-Sharp Minor, Op. 27 No. 2 "Moonlight": I. Adagio sostenuto", artistName: "Vladimir Ashkenazy")))
after I unwrap the above, I'm able to get the song title and artwork object without a problem:
guard let currentEntry = appleMusicManager.queue.currentEntry else { return }
self.songTitle = currentEntry.title)
self.albumArtwork = currentEntity.artwork
}
However, my issue is that I cannot get the artist name from the embedded "item" object:
print(currentEntry.item.artistName)
I tried everything from attempting to cast currentEntry.item
to Song
, but nothing seemed to work. Is there any way to get access to all the song instance properties from within the player queue?
TIA.
- Scott