Ordered concurrent downloads
You're given an array of image ids [3, 1, 2]. Download each image concurrently, but display them on screen in id order (1, 2, 3). How would you do that with Swift Concurrency?
You're given an array of image ids [3, 1, 2]. Download each image concurrently, but display them on screen in id order (1, 2, 3). How would you do that with Swift Concurrency?
Add a child task per id in withThrowingTaskGroup to download at the same time, collect results as (id, image) into a dictionary, then pull them out in ids.sorted() order. The point is separating completion order from display order.
ConcurrencyMultiple choiceAdvanced
Which of the following statements about structured concurrency (async let, TaskGroup) are…
#taskgroup #structured-concurrency #cancellation
ConcurrencyShort answerBasics
When the search query changes, the previous search's network, decoding, and image work…
#structured-concurrency #cancellation
ConcurrencyShort answerBasics
You're building an image pipeline: download, resize, then save to the disk cache, and…
#cancellation
ConcurrencyShort answerBasics
When a screen appears you call three APIs in parallel, profile, feed, and notifications…
#taskgroup