Cache SwiftUI ArtworkImage

Hi,

is there a way to cache the data from the SwiftUI ArtworkImage across App starts and maybe even for offline use?

Best regards Julian

Replies

Hello @juka1205,

MusicKit uses the shared URLSession to load the data for ArtworkImage. So it should benefit from the default URL caching behavior associated with the shared URLSession, much like what happens with SwiftUI's AsyncImage.

I hope this helps.

Best regards,

thanks Joe, but there doesn't seem to be a great deal of caching going on... why not expose an artwork.image object we can cache ourselves?

Hello @mcapezzani,

We can investigate ways to improve caching of the image data used by ArtworkImage.

I would encourage you to file a ticket on Feedback Assistant with this enhancement request, including a brief explanation on how this impacts your app. This will help us to schedule this improvement in our upcoming roadmap.

Thank you very much in advance.

Best regards,