Description
Currently I'm super happy to use this macro, it allows me to drop third party dependency an the fact that mocks are generated in the main target allows me to reduce a boilerplate code for view model mocks for swift ui previews.
However I already run multiple times in a situation when I could use a computed property instead of method but unfortunately I can't specify ThrowableError as for the methods. Consider following code.
@Spyable
protocol FacebookLoginRepositoryProtocol {
var isRegistered: Bool { get async throws }
}
I would really love to have something like this:
let repositoryMock = FacebookLoginRepositoryProtocolSpy()
repositoryMock.isRegisteredThrowableError = MyError.error
As for now the only code macro generates is this:
class FacebookLoginRepositoryProtocolSpy: FacebookLoginRepositoryProtocol {
var isRegistered: Bool {
get {
underlyingIsRegistered
}
set {
underlyingIsRegistered = newValue
}
}
var underlyingIsRegistered: (Bool)!
}
Would it be possible to implement something like I mentioned above? Sorry I didn't check source code that much and maybe there are some limitations about which I don't know.
Alternatively I still can use a method which is not a big deal, but I like to keep my codebase clean as much as possible.