Types that must be MainActor, but cannot be MainActor due to protocol conformance

Yeah, the recommended way to do this is using MainActor.assumeIsolated. The goal of SE-0423: Dynamic actor isolation enforcement from non-strict-concurrency contexts is to streamline this pattern using @preconcurrency protocol conformances since this pattern is so pervasive and necessary to facilitate an incremental migration for an entire ecosystem of Swift code.

10 Likes