Get Updates By E-mail 

Article Written By:
Johann Dowa

Open Source:NSNotification And KVO Objective-C Categories For Automatic Observer Removal

  •  
  •  
  •  
  •  
  •  

ARC has been a great addition for developers using Objective-C almost completely eliminating any need for the dealloc method.  That being said if you employ the observer pattern you need to unregister before you release your observer object or suffer unwanted consequences.

That’s where this very useful collection of submitted categories come in.  These categories provide automatic removal for observers when the observer object is deallocated.

What’s really nice is that there is no need to change your code simply include the categories in your project, and you are good to go.  The categories work in both ARC and non-ARC apps.

The library is SFObservers from Kryzystof Zablocki and can be found on Github here.

You can read Kryzystof’s methodology in developing the categories on his site here.

This is extremely useful, as thanks to ARC and this category the need to create a dealloc method is now nearly eliminated.

Thanks to Krzystof for the submission.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments