Swift 6 (from Xcode 16b5), overridden function and isolation

To be clear, my fix is only for subclassing NSObject.init() because to experience a data race, you'd need to call the subclass override dynamically through an NSObject metatype, which I think is rare (or impossible?). It is correct to get an error when trying to override a nonisolated superclass method in a subclass that adds actor isolation, and that was already the case for this pattern written purely in Swift. If you believe that a superclass method from an Apple framework you're using is missing an annotation like @MainActor, please report the issue via Apple Feedback Assistant.

2 Likes