RSSAmplifier

Ole Begemann · May 5, 2022

How @MainActor works

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

@MainActor is a Swift annotation to coerce a function to always run on the main thread and to enable the compiler to verify this. How does this work? In this article, I’m going to reimplement @MainActor in a slightly simplified form for illustration purposes, mainly to show how little “magic” there is to it. The code of the real implementation in the Swift standard library is available in the…

Read on oleb.net

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.