0Pricing
Swift Academy · Lesson

Actors: Protecting Shared Mutable State

Using actor to serialize access and prevent data races at compile time.

Welcome

Swift Actors protect shared mutable state from concurrent access using *actor isolation*. They provide safe concurrency without manual locks.

Defining an Actor

```swift actor Counter { var count = 0 func increment() { count += 1 } func value() -> Int { count } } ```

All lessons in this course

  1. async/await Syntax and Calling Async Functions
  2. Task and Task Cancellation
  3. async let and Concurrent Child Tasks
  4. Actors: Protecting Shared Mutable State
← Back to Swift Academy