mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-24 02:11:26 +01:00
accept optionals in setValue
This commit is contained in:
@@ -150,14 +150,14 @@ public extension NSManagedObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
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.
|
Provides a convenience wrapper for setting `setPrimitiveValue(_:forKey:)` with proper calls to `willChangeValue(forKey:)` and `didChangeValue(forKey:)`.
|
||||||
|
|
||||||
- parameter value: the value to set the KVC key with
|
- parameter value: the value to set the KVC key with
|
||||||
- parameter KVCKey: the KVC key
|
- parameter KVCKey: the KVC key
|
||||||
- parameter didSetValue: called after executing `setPrimitiveValue(forKey:)`.
|
- parameter didSetValue: called after executing `setPrimitiveValue(forKey:)`.
|
||||||
*/
|
*/
|
||||||
@nonobjc @inline(__always)
|
@nonobjc @inline(__always)
|
||||||
public func setValue(_ value: Any, forKvcKey KVCKey: KeyPath, didSetValue: () -> Void) {
|
public func setValue(_ value: Any?, forKvcKey KVCKey: KeyPath, didSetValue: () -> Void) {
|
||||||
|
|
||||||
self.willChangeValue(forKey: KVCKey)
|
self.willChangeValue(forKey: KVCKey)
|
||||||
defer {
|
defer {
|
||||||
|
|||||||
Reference in New Issue
Block a user