mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-04-21 00:11:25 +02:00
added missing utilities
This commit is contained in:
@@ -91,6 +91,29 @@ public struct PartialObject<O: CoreStoreObject> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func primitiveValue<V: ImportableAttributeType>(for property: (O) -> ValueContainer<O>.Required<V>) -> V {
|
||||||
|
|
||||||
|
return V.cs_fromImportableNativeType(
|
||||||
|
self.rawObject.primitiveValue(forKey: property(O.meta).keyPath)! as! V.ImportableNativeType
|
||||||
|
)!
|
||||||
|
}
|
||||||
|
|
||||||
|
public func primitiveValue<V: ImportableAttributeType>(for property: (O) -> ValueContainer<O>.Optional<V>) -> V? {
|
||||||
|
|
||||||
|
return (self.rawObject.primitiveValue(forKey: property(O.meta).keyPath) as! V.ImportableNativeType?)
|
||||||
|
.flatMap(V.cs_fromImportableNativeType)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func primitiveValue<V: NSCoding & NSCopying>(for property: (O) -> TransformableContainer<O>.Required<V>) -> V {
|
||||||
|
|
||||||
|
return self.rawObject.primitiveValue(forKey: property(O.meta).keyPath)! as! V
|
||||||
|
}
|
||||||
|
|
||||||
|
public func primitiveValue<V: NSCoding & NSCopying>(for property: (O) -> TransformableContainer<O>.Optional<V>) -> V? {
|
||||||
|
|
||||||
|
return self.rawObject.primitiveValue(forKey: property(O.meta).keyPath) as! V?
|
||||||
|
}
|
||||||
|
|
||||||
public func setPrimitiveValue<V: ImportableAttributeType>(_ value: V, for property: (O) -> ValueContainer<O>.Required<V>) {
|
public func setPrimitiveValue<V: ImportableAttributeType>(_ value: V, for property: (O) -> ValueContainer<O>.Required<V>) {
|
||||||
|
|
||||||
self.rawObject.setPrimitiveValue(
|
self.rawObject.setPrimitiveValue(
|
||||||
|
|||||||
Reference in New Issue
Block a user