diff --git a/Sources/AttributeProtocol.swift b/Sources/AttributeProtocol.swift index 37aa359..df70185 100644 --- a/Sources/AttributeProtocol.swift +++ b/Sources/AttributeProtocol.swift @@ -43,5 +43,5 @@ internal protocol AttributeProtocol: PropertyProtocol { var rawObject: CoreStoreManagedObject? { get set } var getter: CoreStoreManagedObject.CustomGetter? { get } var setter: CoreStoreManagedObject.CustomSetter? { get } - var valueForSnapshot: Any { get } + var valueForSnapshot: Any? { get } } diff --git a/Sources/DiffableDataSource.CollectionView-UIKit.swift b/Sources/DiffableDataSource.CollectionView-UIKit.swift index 985905f..04943f0 100644 --- a/Sources/DiffableDataSource.CollectionView-UIKit.swift +++ b/Sources/DiffableDataSource.CollectionView-UIKit.swift @@ -120,7 +120,7 @@ extension DiffableDataSource { let diffableSnapshot = snapshot.diffableSnapshot self.dispatcher.apply( - diffableSnapshot as! Internals.DiffableDataSourceSnapshot, + diffableSnapshot, view: self.collectionView, animatingDifferences: animatingDifferences, performUpdates: { collectionView, changeset, setSections in diff --git a/Sources/ObjectPublisher.swift b/Sources/ObjectPublisher.swift index 7412fc1..ce2cfde 100644 --- a/Sources/ObjectPublisher.swift +++ b/Sources/ObjectPublisher.swift @@ -356,7 +356,7 @@ extension ObjectPublisher where O: NSManagedObject { public func value(forKeyPath keyPath: KeyPath) -> V! { let key = String(keyPath: keyPath) - return self.snapshot?.dictionaryForValues()[key] as? V + return self.snapshot?.dictionaryForValues()[key] as! V? } } diff --git a/Sources/ObjectSnapshot.swift b/Sources/ObjectSnapshot.swift index 259c536..f01cbff 100644 --- a/Sources/ObjectSnapshot.swift +++ b/Sources/ObjectSnapshot.swift @@ -157,7 +157,7 @@ extension ObjectSnapshot where O: NSManagedObject { public func value(forKeyPath keyPath: KeyPath) -> V! { let key = String(keyPath: keyPath) - return self.values[key] as? V + return self.values[key] as! V? } /** diff --git a/Sources/PartialObject.swift b/Sources/PartialObject.swift index 82f8731..9d42664 100644 --- a/Sources/PartialObject.swift +++ b/Sources/PartialObject.swift @@ -191,7 +191,7 @@ public struct PartialObject { */ public func value(for property: (O) -> TransformableContainer.Optional) -> V? { - return self.rawObject.value(forKey: property(O.meta).keyPath) as? V + return self.rawObject.value(forKey: property(O.meta).keyPath) as! V? } /** @@ -212,7 +212,7 @@ public struct PartialObject { */ public func primitiveValue(for property: (O) -> TransformableContainer.Optional) -> V? { - return self.rawObject.primitiveValue(forKey: property(O.meta).keyPath) as? V + return self.rawObject.primitiveValue(forKey: property(O.meta).keyPath) as! V? } /** diff --git a/Sources/Relationship.swift b/Sources/Relationship.swift index 120a799..74c72d5 100644 --- a/Sources/Relationship.swift +++ b/Sources/Relationship.swift @@ -313,9 +313,9 @@ public enum RelationshipContainer { } } - internal var valueForSnapshot: Any { + internal var valueForSnapshot: Any? { - return self.value?.objectID() as Any + return self.value?.objectID() } @@ -609,9 +609,9 @@ public enum RelationshipContainer { } } - internal var valueForSnapshot: Any { + internal var valueForSnapshot: Any? { - return self.value.map({ $0.objectID() }) as Any + return self.value.map({ $0.objectID() }) } @@ -910,9 +910,9 @@ public enum RelationshipContainer { } } - internal var valueForSnapshot: Any { + internal var valueForSnapshot: Any? { - return Set(self.value.map({ $0.objectID() })) as Any + return Set(self.value.map({ $0.objectID() })) } diff --git a/Sources/RelationshipProtocol.swift b/Sources/RelationshipProtocol.swift index b2269a5..0f53b88 100644 --- a/Sources/RelationshipProtocol.swift +++ b/Sources/RelationshipProtocol.swift @@ -41,5 +41,5 @@ internal protocol RelationshipProtocol: PropertyProtocol { var renamingIdentifier: () -> String? { get } var minCount: Int { get } var maxCount: Int { get } - var valueForSnapshot: Any { get } + var valueForSnapshot: Any? { get } } diff --git a/Sources/Transformable.swift b/Sources/Transformable.swift index 182f0bc..5129047 100644 --- a/Sources/Transformable.swift +++ b/Sources/Transformable.swift @@ -272,9 +272,9 @@ public enum TransformableContainer { } } - internal var valueForSnapshot: Any { + internal var valueForSnapshot: Any? { - return self.value as Any + return self.value } @@ -380,7 +380,7 @@ public enum TransformableContainer { return customGetter(PartialObject(object)) } - return object.value(forKey: self.keyPath) as? V + return object.value(forKey: self.keyPath) as! V? } } set { @@ -489,14 +489,14 @@ public enum TransformableContainer { } customSetter( PartialObject(rawObject), - newValue as? V + newValue as! V? ) } } - internal var valueForSnapshot: Any { + internal var valueForSnapshot: Any? { - return self.value as Any + return self.value } diff --git a/Sources/Value.swift b/Sources/Value.swift index fec2e9a..2bd6cef 100644 --- a/Sources/Value.swift +++ b/Sources/Value.swift @@ -267,9 +267,9 @@ public enum ValueContainer { } } - internal var valueForSnapshot: Any { + internal var valueForSnapshot: Any? { - return self.value as Any + return self.value } @@ -489,9 +489,9 @@ public enum ValueContainer { } } - internal var valueForSnapshot: Any { + internal var valueForSnapshot: Any? { - return self.value as Any + return self.value }