ContextObserver is used to help observer NSManagedObjects. ContextObserver will let you observer:
- Any changes on an NSManagedObject (including relationships)
- A keypath of an NSManagedObject
let observer = ContextObserver(context: mainContext)
observer.add(observer: self, for: managedObject) { (change) in
...
})
...
observer.remove(self)
let observer = ContextObserver(context: mainContext)
observer.add(observer: self, for: managedObject, keyPath: someKeyPath) { (change) in
...
})
...
observer.remove(self)
To run the example project, clone the repo, and run pod install
from the Example directory first.
ContextObserver is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ContextObserver'
datinc
ContextObserver is available under the MIT license. See the LICENSE file for more info.