CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

DMAutoInvalidation 2.1.2

DMAutoInvalidation 2.1.2

TestsTested
LangLanguage Obj-CObjective C
License Custom
ReleasedLast Release May 2015

Maintained by Jonathon Mah.



  • By
  • Jonathon Mah and Wil Shipley

Block-based observers that automatically unregister themselves.

The DMAutoInvalidation class provides behavior to attach an observer object to an owning object. When the owning object is about to deallocate, -invalidate is sent to the observer object.

This library includes pre-built observers for NSNotifcation, key-value observing, Core Data managed objects (observing NSManagedObjectContextObjectsDidChangeNotification and testing if an observed managed object's attributes or relationships have changed), and FSEvents (on Mac desktop only).

The purpose of this is to model observer registration as an object, each with an associated block. This removes the need for the owning objects to dispatch to the desired code (if the observation always funnels through a single callback, such as key-value observing), and removes the need to manually unregister for notifications. With that, the possibility of forgetting to unregister for a notification (and the subsequent crash or bad behavior) is removed.

Installation

pod 'DMAutoInvalidation'

Authors

Jonathon Mah and Wil Shipley

License

Custom