Async/Await and MainActor Strategies

Deciding where and how to update the main thread.

Michael Long
The Swift Cooperative
13 min readApr 23, 2023

--

Photo by amirali mirhashemian on Unsplash

Pretty much every article that discusses Swift async/await will throw in a comment regarding @MainActor and how it can be used to ensure that any updates to the user interface will occur on the main thread.

That’s all well and good… but just where should the @MainActor attribute go? On the…

--

--

Michael Long
The Swift Cooperative

I write about Apple, Swift, and SwiftUI in particular, and technology in general. I'm also a Lead iOS Engineer at InRhythm, a modern digital consulting firm.