Skip to content

Generated Pb files fail to compile with the new Default Actor Isolation flag set to MainActor #1797

@mylaluna

Description

@mylaluna

After watching the WWDC 2025, Embracing Swift concurrency, I try to play with the new concurrency flags which you can find on the Xcode 26 beta.

Following is the recommended flag settings from the tutorial video:

Image

I find my existing project that contains generated *.pb.swift files have hundreds of compile time errors, if I set the Default Actor Isolation to the MainActor.

Some typical errors are like: Conformance of "Pb_Person" to protocol 'Enum' crosses into main actor-isolated code and can cause data races.

The fix is to set the flag to nonisolated which I believe was the default before Swift 6.2.

This makes sense because the generated code is created with the nonisolated as default actor isolation.
Since Apple has recommended the new default isolation, the current generated code will be a road block for those who want to switch to the MainActor default.
What is the solution here for the existing projects and new projects?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions