Kolos65 / Mockable

A Swift macro driven auto-mocking library.
MIT License
233 stars 18 forks source link

Mockable on Private Protocol Cannot Be Initialized Due to Private Initializer #48

Closed hainayanda closed 3 months ago

hainayanda commented 4 months ago

In rare instances, a protocol marked with Mockable may be private and used solely within its file. If this happens, the generated mock cannot be initialized because its initializer is marked as private. While marking the protocol as fileprivate can resolve this issue, it is undesirable. Could the initializer, and generated members of the mock be restricted to an access modifier no less accessible than fileprivate?

example: Screenshot 2024-05-29 at 9 30 58 AM

Inlining the Mock will give me this error:

Method 'registerUser(_:password:)' must be declared fileprivate because it matches a requirement in private protocol 'RegisterViewInteractor'
hainayanda commented 4 months ago

I create a PR for this here