Unnecessary "self" in a closure

Hello. I found a weird code in a class.

rx.didEndEditing.subscribe(onNext: { [unowned self] in
        if text != nil || text != "" { return }
        dropText()
}).disposed(by: disposeBag)

dropText() is a method of the class. I think I need to put self before dropText() because it is in a closure.
But it works without self. Why is it OK?

That would be SE-0269. :slightly_smiling_face:

1 Like
Terms of Service

Privacy Policy

Cookie Policy