Prefetching and image preparation and TCA #940
Unanswered
mycroftcanner
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
After watching WWDC I tried to implement some of the new APIs to prepare images for display.
Some items in my store have thumbnail information and the view for those items needs a UIImage ... However coordinating this inside a reducer that runs on the main queue is quite inefficient:
If the thumbnail has been cached it is loaded from there:
otherwise we load it, prepare a thumbnail of the right size, starts a utility task to compress it and cache it :
Right now I am doing all this work from the a task :
n.b. VisualView is a UIViewRepresentable
All of the work is done in the background using a task ... I could do that work in the background via the store's environment but then I will have to keep the UIImage inside store's state and it will cause many unnecessary updates and thread hopping.
UIImages that are prepared this way take a lot of memory and need to be cleared when the view disappear, causing again unnecessary updates to the store.
Anyone else has encountered similar issues with ephemeral data?
Beta Was this translation helpful? Give feedback.
All reactions