@mattiem High-level advice question for you, if you have some time (if not, that's okay, just posing the question helps me think it through): I'm working on an app that uploads assets. You drop one or more images (or videos, or whatever) on it, it generates zero or more derived assets (think smaller versions), and uploads the original and derived files to a server.
All of this work should take place in the background. I would like for each operation to contribute to progress feedback to the user, both for each individual asset, and all operations as a whole. Each asset and the whole set should be cancelable.
How would you structure the concurrency for this? A top-level Task
for each asset that kicks off a TaskGroup for the generation and upload of each derived asset? An Actor that holds processing state for each derived asset? I find myself falling into Dispatch ways of thinking.
One of the challenges is that I’m using SwiftData, which can create multiple instances of an entity, making it harder for an entity to hold onto a reference to the tasks related to it (does that make sense?). All I can think of is some kind of keyed collection of “progress" objects, maybe keyed off the entity ID.
=> More informations about this toot | View the thread | More toots from JetForMe@geekstodon.com
=> View mattiem@mastodon.social profile
text/gemini
This content has been proxied by September (3851b).