Skip to content

Latest commit

 

History

History
61 lines (39 loc) · 1.57 KB

File metadata and controls

61 lines (39 loc) · 1.57 KB

WIP: ContextObserver

CI Status Version License Platform

ContextObserver is used to help observer NSManagedObjects. ContextObserver will let you observer:

  1. Any changes on an NSManagedObject (including relationships)
  2. A keypath of an NSManagedObject

Observer any changes on a NSManagedObject

let observer = ContextObserver(context: mainContext)
observer.add(observer: self, for: managedObject) { (change) in
    ...
})

...
observer.remove(self)

Observer keypath of an NSManagedObject

let observer = ContextObserver(context: mainContext)
observer.add(observer: self, for: managedObject, keyPath: someKeyPath) { (change) in
...
})

...
observer.remove(self)

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

ContextObserver is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ContextObserver'

Author

datinc

License

ContextObserver is available under the MIT license. See the LICENSE file for more info.