Artwork: to cache or not to cache...
Tuesday, February 21, 2023
Rob In der Maur
Feedback on an app is always immensely valuable. Last week I received very relevant feedback from a user experiencing artwork not showing up when scrolling up and down in a long list (spanning multiple screens) in the app. It turned out that the default SwiftUI code I am using (AsyncImage) does not cache images after loading them, so when scrolling images out of the screen view and then back into screen view, triggers a new load of the image once more.
In case you do have a high speed internet connection this is not much of an issue, but with a somewhat less fortunate network infrastructure this flaw becomes quite prominent.
Another request from the same user was about updating artwork for an entry. The app, by default, fetches the artwork for an entry from the music service that is used to search for an entry (iTunes, Apple Music, Spotify). In case you can not find an entry in your selected music service (old unknown track, independent music entry you created yourself) you can add a blank entry but there is currently no way to update the artwork for this blank entry. Resulting in the boring default image for artwork.
In the latest version of the app both 'issues' are fixed:
artwork images are now cached, so not reloaded, when scrolling up or down in large lists or moving between various screens.
you can independently update the artwork for an entry. In the Edit Entry screen, long tap on the Update button and a alert dialog pops up allowing to define an URL pointing to a jpg, jpeg or png representing your preferred artwork.
Both changes are now available in the latest version in the app (1.1.11) which you can find already in the app store.