-
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
weak_delegate gets triggered on Protocols that don't inherit from class #972
Comments
Yeah, we can't do that without changing how SwiftLint works (at least I don't see how). See #836 (comment) for more info. Just curious: do you find yourself using this a lot? I always use |
We don't have that many. |
Actually when I wrote the rule I wondered if I should consider the case, but in fact I also wanted for the rule to enforce protocols used as delegates to always be class protocols, because that's how it should always be. Enforcing delegates to be weak has the (good, imho) consequence of enforcing protocols to be class protocols because non-class protocols can't be marked as weak, so the aim of the rule is actually to kill two birds with one stone, enforcing both class protocols and weak. Maybe we should just amend the warning message to make it more clear and not only warn that delegates should be marked as weak but should also be class-bound protocols? |
Maybe we could make it another explicit rule that checks for |
Ha, could be a solution indeed 👍 |
Not sure how this can be enforced properly, but this rule is not really usable properly unless this is can be possible.
The text was updated successfully, but these errors were encountered: