Post #2625593
2026-04-30 16:40 UTC
@mattiem@mastodon.social Ok, I think you can really help me with this issue that I can't figure out. I have this struct for analytics events. For network events I add on a couple of properties that can only be accessed on the main thread. But if I make networkProperties MainActor then I get an error that I can't call it in a synchronous nonisolated context.
Replies (1)
-
@mattiem@mastodon.social 2026-04-30 17:17
@agarrharr@mstdn.social What you have here is an arrangement that fundamentally need *synchronous* access to MainActor state. Synchronous access => must be the same isolation. So the compiler is forcing you to decide. Does everything become MainActor, or should some accesses become asynchronous?