mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-26 03:11:30 +01:00
updated documentation (fixes #198)
This commit is contained in:
@@ -34,6 +34,9 @@ import Foundation
|
||||
*/
|
||||
public struct PartialObject<O: CoreStoreObject> {
|
||||
|
||||
/**
|
||||
Returns a the actual `CoreStoreObject` instance for the receiver.
|
||||
*/
|
||||
public func completeObject() -> O {
|
||||
|
||||
return O.cs_fromRaw(object: self.rawObject)
|
||||
@@ -42,6 +45,9 @@ public struct PartialObject<O: CoreStoreObject> {
|
||||
|
||||
// MARK: Value.Required accessors/mutators
|
||||
|
||||
/**
|
||||
Returns the value for the property identified by a given key.
|
||||
*/
|
||||
public func value<V>(for property: (O) -> ValueContainer<O>.Required<V>) -> V {
|
||||
|
||||
return V.cs_fromQueryableNativeType(
|
||||
@@ -49,6 +55,9 @@ public struct PartialObject<O: CoreStoreObject> {
|
||||
)!
|
||||
}
|
||||
|
||||
/**
|
||||
Sets the property of the receiver specified by a given key to a given value.
|
||||
*/
|
||||
public func setValue<V>(_ value: V, for property: (O) -> ValueContainer<O>.Required<V>) {
|
||||
|
||||
self.rawObject.setValue(
|
||||
@@ -57,6 +66,11 @@ public struct PartialObject<O: CoreStoreObject> {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the value for the specified property from the managed object’s private internal storage.
|
||||
|
||||
This method does not invoke the access notification methods (`willAccessValue(forKey:)` and `didAccessValue(forKey:)`). This method is used primarily by subclasses that implement custom accessor methods that need direct access to the receiver’s private storage.
|
||||
*/
|
||||
public func primitiveValue<V>(for property: (O) -> ValueContainer<O>.Required<V>) -> V {
|
||||
|
||||
return V.cs_fromQueryableNativeType(
|
||||
@@ -64,6 +78,11 @@ public struct PartialObject<O: CoreStoreObject> {
|
||||
)!
|
||||
}
|
||||
|
||||
/**
|
||||
Sets in the object's private internal storage the value of a given property.
|
||||
|
||||
Sets in the receiver’s private internal storage the value of the property specified by key to value.
|
||||
*/
|
||||
public func setPrimitiveValue<V>(_ value: V, for property: (O) -> ValueContainer<O>.Required<V>) {
|
||||
|
||||
self.rawObject.setPrimitiveValue(
|
||||
@@ -75,12 +94,18 @@ public struct PartialObject<O: CoreStoreObject> {
|
||||
|
||||
// MARK: Value.Optional utilities
|
||||
|
||||
/**
|
||||
Returns the value for the property identified by a given key.
|
||||
*/
|
||||
public func value<V>(for property: (O) -> ValueContainer<O>.Optional<V>) -> V? {
|
||||
|
||||
return (self.rawObject.value(forKey: property(O.meta).keyPath) as! V.QueryableNativeType?)
|
||||
.flatMap(V.cs_fromQueryableNativeType)
|
||||
}
|
||||
|
||||
/**
|
||||
Sets the property of the receiver specified by a given key to a given value.
|
||||
*/
|
||||
public func setValue<V>(_ value: V?, for property: (O) -> ValueContainer<O>.Optional<V>) {
|
||||
|
||||
self.rawObject.setValue(
|
||||
@@ -89,12 +114,22 @@ public struct PartialObject<O: CoreStoreObject> {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the value for the specified property from the managed object’s private internal storage.
|
||||
|
||||
This method does not invoke the access notification methods (`willAccessValue(forKey:)` and `didAccessValue(forKey:)`). This method is used primarily by subclasses that implement custom accessor methods that need direct access to the receiver’s private storage.
|
||||
*/
|
||||
public func primitiveValue<V>(for property: (O) -> ValueContainer<O>.Optional<V>) -> V? {
|
||||
|
||||
return (self.rawObject.primitiveValue(forKey: property(O.meta).keyPath) as! V.QueryableNativeType?)
|
||||
.flatMap(V.cs_fromQueryableNativeType)
|
||||
}
|
||||
|
||||
/**
|
||||
Sets in the object's private internal storage the value of a given property.
|
||||
|
||||
Sets in the receiver’s private internal storage the value of the property specified by key to value.
|
||||
*/
|
||||
public func setPrimitiveValue<V>(_ value: V?, for property: (O) -> ValueContainer<O>.Optional<V>) {
|
||||
|
||||
self.rawObject.setPrimitiveValue(
|
||||
@@ -106,11 +141,17 @@ public struct PartialObject<O: CoreStoreObject> {
|
||||
|
||||
// MARK: Transformable.Required utilities
|
||||
|
||||
/**
|
||||
Returns the value for the property identified by a given key.
|
||||
*/
|
||||
public func value<V>(for property: (O) -> TransformableContainer<O>.Required<V>) -> V {
|
||||
|
||||
return self.rawObject.value(forKey: property(O.meta).keyPath)! as! V
|
||||
}
|
||||
|
||||
/**
|
||||
Sets the property of the receiver specified by a given key to a given value.
|
||||
*/
|
||||
public func setValue<V>(_ value: V, for property: (O) -> TransformableContainer<O>.Required<V>) {
|
||||
|
||||
self.rawObject.setValue(
|
||||
@@ -119,11 +160,21 @@ public struct PartialObject<O: CoreStoreObject> {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the value for the specified property from the managed object’s private internal storage.
|
||||
|
||||
This method does not invoke the access notification methods (`willAccessValue(forKey:)` and `didAccessValue(forKey:)`). This method is used primarily by subclasses that implement custom accessor methods that need direct access to the receiver’s private storage.
|
||||
*/
|
||||
public func primitiveValue<V>(for property: (O) -> TransformableContainer<O>.Required<V>) -> V {
|
||||
|
||||
return self.rawObject.primitiveValue(forKey: property(O.meta).keyPath)! as! V
|
||||
}
|
||||
|
||||
/**
|
||||
Sets in the object's private internal storage the value of a given property.
|
||||
|
||||
Sets in the receiver’s private internal storage the value of the property specified by key to value.
|
||||
*/
|
||||
public func setPrimitiveValue<V>(_ value: V, for property: (O) -> TransformableContainer<O>.Required<V>) {
|
||||
|
||||
self.rawObject.setPrimitiveValue(
|
||||
@@ -135,11 +186,17 @@ public struct PartialObject<O: CoreStoreObject> {
|
||||
|
||||
// MARK: Transformable.Optional utilities
|
||||
|
||||
/**
|
||||
Returns the value for the property identified by a given key.
|
||||
*/
|
||||
public func value<V>(for property: (O) -> TransformableContainer<O>.Optional<V>) -> V? {
|
||||
|
||||
return self.rawObject.value(forKey: property(O.meta).keyPath) as! V?
|
||||
}
|
||||
|
||||
/**
|
||||
Sets the property of the receiver specified by a given key to a given value.
|
||||
*/
|
||||
public func setValue<V>(_ value: V?, for property: (O) -> TransformableContainer<O>.Optional<V>) {
|
||||
|
||||
self.rawObject.setValue(
|
||||
@@ -148,11 +205,21 @@ public struct PartialObject<O: CoreStoreObject> {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the value for the specified property from the managed object’s private internal storage.
|
||||
|
||||
This method does not invoke the access notification methods (`willAccessValue(forKey:)` and `didAccessValue(forKey:)`). This method is used primarily by subclasses that implement custom accessor methods that need direct access to the receiver’s private storage.
|
||||
*/
|
||||
public func primitiveValue<V>(for property: (O) -> TransformableContainer<O>.Optional<V>) -> V? {
|
||||
|
||||
return self.rawObject.primitiveValue(forKey: property(O.meta).keyPath) as! V?
|
||||
}
|
||||
|
||||
/**
|
||||
Sets in the object's private internal storage the value of a given property.
|
||||
|
||||
Sets in the receiver’s private internal storage the value of the property specified by key to value.
|
||||
*/
|
||||
public func setPrimitiveValue<V>(_ value: V?, for property: (O) -> TransformableContainer<O>.Optional<V>) {
|
||||
|
||||
self.rawObject.setPrimitiveValue(
|
||||
|
||||
Reference in New Issue
Block a user