MakeAWishFoundation/SwiftyMocky

[Feature Request] mock actor protocols

DwayneCoussement opened this issue · 2 comments

Hi,

We are using actors that implement a protocol and we ran into a problem while generating mocks.

We have the following protocol

protocol AwesomeProtocol: Actor {
   func test()
}

Notice if we generate mocks now, the generated code will be invalid Swift code:

open class AwesomeProtocolMock: AwesomeProtocol, Mock {
///  code for classes
}

Expected in this case would be:

public actor AwesomeProtocolMock: AwesomeProtocol, Mock {
///  code for actors
}

Would be cool to have these features as well.

Dwayne

There is also another use case, if you have a class / method that is annotated with @MainActor, the code gets generated with the annotation, but internal mock code does not support actors, so you get a bunch of errors