Leave a rating/review
Welcome back to our course Modern Concurrency: Beyond the Basics.
In Part 1, you learned about AsyncStream, unit testing and continuations. At this point, you’re pretty comfortable with designing code with async/await, creating asynchronous sequences and running tasks in parallel with async let bindings.
async let concurrency doesn’t scale up beyond a few tasks. Also, what if you don’t know exactly which tasks you want to run in parallel?
Part 2 introduces TaskGroup for truly dynamic concurrency.
Concurrency brings the possibility of data races, so you’ll go beyond MainActor and
learn how to use the Actor API to make your code thread safe.
You can safely use a default, shared instance of MainActor from anywhere, whenever you need to make quick changes that drive the UI. There are other times you need an app-wide, single-instance shared state, like a database layer or an image or data cache.
You’ll create a global actor to provide a persistent, on-disk image cache that allows easy and safe access to shared resources from anywhere in your app.