swift-spyable
swift-spyable copied to clipboard
Use protocol's access control on the spy's declaration
Is your feature request related to a problem? Please describe. If you use the macro on a public protocol declaration from module A and you have a unit test in another module that you'd like to use the protocol spy from module A, you don't have visibility to the Spy in module B since it's declared as internal.
Describe the solution you'd like The generated spy should use the same access control as the attached protocol's.
Describe alternatives you've considered You could import the module as testable
Additional context
@Matejkob Any chance to get this feature any time soon?
@Matejkob This is an essential feature if you are using this in a library.
@armintelker I'm aware of that, and I already have a ready implementation on a branch, just waiting to test it. I'll try to create a PR in a few days!
Hi everyone! Thanks for your patience and for emphasizing how important this feature is.
I’m happy to share that a new PR (#130) has been created to address this issue. The implementation ensures that generated spies inherit the protocol’s access control, solving the visibility issues described here.
I’m planning to merge the PR in 2/3 days to allow time for community feedback. I’d love to hear your thoughts or suggestions on the new implementation—your input is always valuable!
CC @AndreiVataselu @andriyslyusar @armintelker
Thanks you time and effort! I will give it a try next week.