Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Pass observer to the callback closure, to avoid retain cycle or [weak self] boilerplate #59
Would it make sense to pass the observer as a parameter in the callback closure? Something like:
This will allow to convert this:
This would work and some might prefer it, but I do like the bare bones closure approach. This would work even better if you could name observer as "self", overriding the instance reference complectly in the closure, so that one would not have any way of accidentally capturing the actual instance.