MainActor ● メインスレッドで実行される特別な Actor ● Global Actor の一種 ○ むしろメインスレッドのために Global Actor が提案された ○ 共有の actor インスタンスを通して Actor 分離がされる ● @MainActor で型全部、プロパティのみ、メソッドのみなど適応できる
参考資料 ● Race condition vs. Data Race: the differences explained ● データ競合 (data race) と競合状態 (race condition) を混同しない ● Protect mutable state with Swift actors ● https://github.com/apple/swift-evolution/blob/main/proposals/0316-glo bal-actors.md ● Explore structured concurrency in Swift ● Meet async/await in Swift