fix fixits

This commit is contained in:
John Rommel Estropia
2017-05-21 09:29:34 +09:00
parent d44721fef0
commit 6b3d75bea1

View File

@@ -149,6 +149,25 @@ public extension NSManagedObject {
self.setPrimitiveValue(value, forKey: KVCKey)
}
/**
Provides a convenience wrapper for setting `setPrimitiveValue(_:forKey:)` with proper calls to `willChangeValue(forKey:)` and `didChangeValue(forKey:)`. This is useful when implementing mutator methods for transient attributes.
- parameter value: the value to set the KVC key with
- parameter KVCKey: the KVC key
- parameter didSetValue: called after executing `setPrimitiveValue(forKey:)`.
*/
@nonobjc @inline(__always)
public func setValue(_ value: Any, forKvcKey KVCKey: KeyPath, didSetValue: () -> Void) {
self.willChangeValue(forKey: KVCKey)
defer {
self.didChangeValue(forKey: KVCKey)
}
self.setPrimitiveValue(value, forKey: KVCKey)
didSetValue()
}
/**
Provides a convenience wrapper for setting `setPrimitiveValue(_:forKey:)` with proper calls to `willChangeValue(forKey:)` and `didChangeValue(forKey:)`. This is useful when implementing mutator methods for transient attributes.
@@ -228,7 +247,7 @@ public extension NSManagedObject {
self.setPrimitiveValue(value, forKey: KVCKey)
}
@available(*, deprecated, renamed: "setValue(_:forKvcKey:willSetValue:didSetValue:)")
@available(*, deprecated, renamed: "setValue(_:forKvcKey:didSetValue:)")
@discardableResult
@nonobjc
public func setValue<T>(_ value: Any?, forKVCKey KVCKey: KeyPath, _ didSetPrimitiveValue: (Any?) throws -> T) rethrows -> T {