Open yagiztw opened 8 months ago
Implicit self is now permitted for weak self captures, after self is unwrapped. For example:
class ViewController { let button: Button func setup() { button.tapHandler = { [weak self] in guard let self else { return } dismiss() // refers to `self.dismiss()` } } func dismiss() { ... } }
I looked into existing rules but couldn't find a rule that would allow us to force having explicit self. It would great if we have a rule for this.
In general, the way to enable explicit self is --self insert, but I would not be surprised if it doesn't currently handle this case.
--self insert
Implicit self is now permitted for weak self captures, after self is unwrapped. For example:
I looked into existing rules but couldn't find a rule that would allow us to force having explicit self. It would great if we have a rule for this.