thanks to protocol extensions, you can now omit ListObserver and ObjectObserver methods you don't need to implement

This commit is contained in:
John Rommel Estropia
2015-08-09 05:04:47 +09:00
parent 83c724f584
commit 283104af3f
3 changed files with 68 additions and 5 deletions

View File

@@ -67,3 +67,22 @@ public protocol ObjectObserver: class {
*/
func objectMonitor(monitor: ObjectMonitor<EntityType>, didDeleteObject object: EntityType)
}
public extension ObjectObserver {
/**
The default implementation does nothing.
*/
func objectMonitor(monitor: ObjectMonitor<EntityType>, willUpdateObject object: EntityType) { }
/**
The default implementation does nothing.
*/
func objectMonitor(monitor: ObjectMonitor<EntityType>, didUpdateObject object: EntityType, changedPersistentKeys: Set<KeyPath>) { }
/**
The default implementation does nothing.
*/
func objectMonitor(monitor: ObjectMonitor<EntityType>, didDeleteObject object: EntityType) { }
}