Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declare the spy as public if the protocol is declared public #73

Closed

Conversation

AndreiVataselu
Copy link

This fixes #72 .

This PR checks if the protocol is declared as public and if it does, marks all the methods and the properties as public in order to be visible from outside of the declaring module. This comes in handy when using modules that use the @Spyable macro and want to use those spies in another modules as well.

Copy link

codecov bot commented Dec 13, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (dc896b6) 96.37% compared to head (3cba66f) 96.44%.

Files Patch % Lines
...cro/Factories/VariablesImplementationFactory.swift 95.45% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #73      +/-   ##
==========================================
+ Coverage   96.37%   96.44%   +0.07%     
==========================================
  Files          16       16              
  Lines         634      676      +42     
==========================================
+ Hits          611      652      +41     
- Misses         23       24       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@KacperCzapp
Copy link

Hi, I'd like to make use of this improvement in my project. Could you please make an update?

@Matejkob
Copy link
Owner

Matejkob commented Jan 3, 2024

Hi, I'd like to make use of this improvement in my project. Could you please make an update?

Hejka @KacperCzapp, I'll attempt to conduct the code review today for those changes. In the meantime, could you please set aside your use case? Also, I'm wondering if we should support all access levels, such as 'fileprivate' or 'package', instead of limiting to just public/internal?

@KacperCzapp
Copy link

KacperCzapp commented Jan 3, 2024

I'm playing around with my own macros too and I can suggest inheriting raw modifiers from the protocol declaration as a default argument to the macro and the user can specify their own modifiers to apply to the spy, either via enum or just plain string: @Spyable(accessLevel: .private) or @Spyable(accessLevel: "private").

@Matejkob
Copy link
Owner

Matejkob commented Feb 5, 2024

I'm closing this pull request in favor of the #80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use protocol's access control on the spy's declaration
3 participants