Synchronization Of Non-isolated Property In Actor

The fact that nonisolated lazy allowed on an actor is a bug: https://forums.swift.org/t/why-nonisolated-lazy-var-is-allowed-on-actor.

You can opt-out from using actor and implement synchorization using NSLock within class that you will mark as @unchecked Sendable (so that you have to ensure this on your own), if the goal is to have synchronous access.

2 Likes