Hacker News new | past | comments | ask | show | jobs | submit login

Using blocks is the one bit of Objective-C that still reminds me of the old MRR style. Just like with retain/release/autorelease, it's one thing understanding the pattern, it's another ensuring that your entire program conforms to it. Anywhere that you capture nontrivial objects is a possible failure point.

ReactiveCocoa has some nice patterns for avoiding block callbacks altogether. Eg:

   [myTarget rac_liftSelector:@selector(receiveCallback:) withSignals:mySignal, nil];
will capture a weak reference to the target, invoke the callback whenever 1 or more events fire and automatically unsubscribe when the target deallocates.



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: