-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Rule Request: Enforce private properties in SwiftUI View
's
#3173
Comments
I created a simple custom rule for this, as a starting point. I will try to make a PR for an official rule.
|
This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions! |
Please keep it open. |
This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions! |
Please keep it open. |
FYI, I created #4769 as a starting point to try and address a subset of these concerns. My team was also looking at a custom rule to detect @State properties and require them to be private. It doesn't cover every concern addressed in here, but it could definitely be updated or configured to cover additional cases if desired. |
New Issue Checklist
New rule request
the community thinks about this.
Apple recommends that state properties in SwiftUI
View
's are private:Would trigger:
Would NOT trigger:
I would like to see an option to enforce that all properties that are not initializers to be private.
See README.md for guidelines on when to mark a rule as opt-in.
Yes, since it's what Apple recommends.
The text was updated successfully, but these errors were encountered: