Suggestion - Runtime warnings in debug builds if @MainActor methods/vars are called from background threads

Is the -Xfrontend -enable-actor-data-race-checks command-line option what you're looking for? This enables runtime warnings (or fatal errors if you set the appropriate env variable) for using an actor-confined thing from outside that actor. I assume it will become the default in Swift 6.

1 Like