Home About Notes

Swift 6 strict concurrency

Jun 20, 2024

After WWDC I have spent my week in the weeds of strict concurrency, here is a perhaps helpful way to think about these keywords:

@MainActor

When you need to ensure your code is run on the main thread (UI stuff, the body in View is a MainActor)

Sendable

A class or struct where you have immutable ("let") data and primitives (or sendable) types that might need to be shared across threads or Tasks

Actor

When you have a variable data that you want the system to manage access to. (think thread/access locks)