mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-15 21:53:39 +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 KVCKey: the KVC key
|
||||
- parameter didSetValue: called after executing `setPrimitiveValue(forKey:)`.
|
||||
*/
|
||||
@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)
|
||||
defer {
|
||||
|
||||
Reference in New Issue
Block a user