SwiftyMocky icon indicating copy to clipboard operation
SwiftyMocky copied to clipboard

[Feature Request] mock actor protocols

Open DwayneCoussement opened this issue 2 years ago • 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

DwayneCoussement avatar Jun 09 '22 11:06 DwayneCoussement

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

choulepoka avatar Jun 24 '22 15:06 choulepoka

Hi,

Any news on this? It would be really great to get Actor protocol supported.

vadimkrutovlv avatar Jul 02 '23 08:07 vadimkrutovlv