SwiftMockGeneratorForXcode icon indicating copy to clipboard operation
SwiftMockGeneratorForXcode copied to clipboard

Generated code does not follow the enclosing class access control

Open GustavoVergara opened this issue 3 years ago • 1 comments

When code is generated it doesn’t set an access control to anything. This raises a compiler error when both the protocol and the mock class are public/open.

For example, this protocol and class:

public protocol FooProtocol {
    func bar(arg: String) -> Int
}

public class FooSpy: FooProtocol {
    var invokedBar = false
    var invokedBarCount = 0
    var invokedBarParameters: (arg: String, Void)?
    var invokedBarParametersList = [(arg: String, Void)]()
    var stubbedBarResult: Int! = 0

    func bar(arg: String) -> Int {
        invokedBar = true
        invokedBarCount += 1
        invokedBarParameters = (arg, ())
        invokedBarParametersList.append((arg, ()))
        return stubbedBarResult
    }
}

Raises the error: image

GustavoVergara avatar Oct 15 '20 17:10 GustavoVergara

Hi @GustavoVergara

Thanks for raising this issue. This feature hasn't been implemented yet but I will add it in the next release.

seanhenry avatar Oct 27 '20 10:10 seanhenry