Concurrency & Asynchronous Programming in Swift

May 20 2025 · Swift 6, iOS 18, Xcode 16

Lesson 02: Actors in Concurrency

Demo

Episode complete

Play next episode

Next

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

In this demo, you’ll update TheMet app to use an actor to isolate data and avoid data races.

@MainActor class TheMetStore: ObservableObject {
  @Published var objects: [Object] = []
  let service = TheMetService()
  let maxIndex: Int
var results = [Object]()
for try await result in taskGroup {
  if let object = result {
    results.append(object)
  }
}
return results
See forum comments
Cinema mode Download course materials from Github
Previous: Instruction Next: Conclusion