Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions SharedCode/KeyCodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ extension KeyCodable where Self: ManagedObject, Keys.RawValue == String {
didAccessValueForKey(key.rawValue)
}

public func accessingValueForKey(key: Keys, @noescape block: () -> ()) {
willAccessValueForKey(key)
block()
didAccessValueForKey(key)
}

public func willChangeValueForKey(key: Keys) {
(self as ManagedObject).willChangeValueForKey(key.rawValue)
}
Expand All @@ -42,6 +48,12 @@ extension KeyCodable where Self: ManagedObject, Keys.RawValue == String {
return changedValues()[key.rawValue]
}

public func changingValueForKey(key: Keys, @noescape block: () -> ()) {
willChangeValueForKey(key)
block()
didChangeValueForKey(key)
}

public func committedValueForKey(key: Keys) -> AnyObject? {
return committedValuesForKeys([key.rawValue])[key.rawValue]
}
Expand Down