From da3a9590ac7d2ebe42d6bb7cec14d0a433e88d5d Mon Sep 17 00:00:00 2001 From: John Rommel Estropia Date: Sun, 21 May 2017 09:38:56 +0900 Subject: [PATCH] accept optionals in setValue --- Sources/NSManagedObject+Convenience.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/NSManagedObject+Convenience.swift b/Sources/NSManagedObject+Convenience.swift index f666ce5..ba30a15 100644 --- a/Sources/NSManagedObject+Convenience.swift +++ b/Sources/NSManagedObject+Convenience.swift @@ -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 {