diff --git a/Sources/PartialObject.swift b/Sources/PartialObject.swift index a47cebf..3f3f90d 100644 --- a/Sources/PartialObject.swift +++ b/Sources/PartialObject.swift @@ -91,6 +91,29 @@ public struct PartialObject { ) } + public func primitiveValue(for property: (O) -> ValueContainer.Required) -> V { + + return V.cs_fromImportableNativeType( + self.rawObject.primitiveValue(forKey: property(O.meta).keyPath)! as! V.ImportableNativeType + )! + } + + public func primitiveValue(for property: (O) -> ValueContainer.Optional) -> V? { + + return (self.rawObject.primitiveValue(forKey: property(O.meta).keyPath) as! V.ImportableNativeType?) + .flatMap(V.cs_fromImportableNativeType) + } + + public func primitiveValue(for property: (O) -> TransformableContainer.Required) -> V { + + return self.rawObject.primitiveValue(forKey: property(O.meta).keyPath)! as! V + } + + public func primitiveValue(for property: (O) -> TransformableContainer.Optional) -> V? { + + return self.rawObject.primitiveValue(forKey: property(O.meta).keyPath) as! V? + } + public func setPrimitiveValue(_ value: V, for property: (O) -> ValueContainer.Required) { self.rawObject.setPrimitiveValue(