Modern Concurrency: Beyond the Basics

Oct 20 2022 · Swift 5.5, iOS 15, Xcode 13.4

Part 2: Concurrent Code

11. Introduction

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: Part 1 Quiz: AsyncStream & Continuations Next episode: 12. TaskGroup

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

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 hopefully 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 two introduces TaskGroup for truly dynamic concurrency. Concurrency brings the possibility of data races, so you go beyond main actor and learn how to use the actor API to make your code thread safe. You can safely use a default shared instance of main actor 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 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. Let's get started.