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
- async/await Syntax and Calling Async Functions
- Task and Task Cancellation
- async let and Concurrent Child Tasks
- Actors: Protecting Shared Mutable State