Swift by Sundell cover image

99: “Structured concurrency”, with special guest Doug Gregor

Swift by Sundell

CHAPTER

The Main Actor Pattern in Swift Type System

The main actor is a very special kind of actor. It's really modeling something that already exists in the system and that every app has had to contend with, which is this notion of the main thread. And so you can mark a particular function or a property as being on the main actor. You need to mark it with a weight and under the hood, the system is doing basically the equivalent of dispatch cue.main.async to go and make that call happen over on the mainthread.

00:00
Transcript
Play full episode

Remember Everything You Learn from Podcasts

Save insights instantly, chat with episodes, and build lasting knowledge - all powered by AI.
App store bannerPlay store banner