Using an actor with protocol conformance on Linux

I have a public actor StreamCommandQueue: NSObject , which implements StreamDelegate, hence I have to derive from NSObject.

On Apple platforms, that works fine. On Linux I get the error:

error: actor-isolated initializer 'init()' has different actor isolation from nonisolated overridden declaration
public actor StreamCommandQueue: NSObject {
                                          ^
Foundation.NSObject:2:12: note: overridden declaration is here
    public init()
           ^

Why the difference and how am I supposed to fix that?

This is probably a bug, likely in swift-corelibs-foundation. Can you file a bugs.swift.org report about it?

1 Like

You can try to work around this by overriding the default initializer.