NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

Having trouble understanding Threads/MainActor

Forums > Swift


I'm having trouble finding up-to-date examples/resources for concurrency, especially when it comes to using MainActor to manage threads. (I'm now pretty comfortable with async/await)

There is an example project by Paul for DispatchQueue (, but as far as I know Swift Concurrency now 'replaces' (correct me if I'm wrong) DispatchQueue.main with MainActor. I looked through some videos online and docs, but I still don't fully grasp how to use it. Can anyone link any sample codes or projects to get a better understanding of how to manage threads and use MainActor?


Hacking with Swift is sponsored by Play

SPONSORED Play is the first native iOS design tool created for designers and engineers. You can install Play for iOS and iPad today and sign up to check out the Beta of our macOS app with SwiftUI code export. We're also hiring engineers!

Click to learn more about Play!

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.