DynamicObject
public protocol DynamicObject : AnyObject
All CoreStore’s utilities are designed around DynamicObject
instances. NSManagedObject
and CoreStoreObject
instances all conform to DynamicObject
.
-
Used internally by CoreStore. Do not call directly.
Declaration
Swift
static func cs_forceCreate(entityDescription: NSEntityDescription, into context: NSManagedObjectContext, assignTo store: NSPersistentStore) -> Self
-
Used internally by CoreStore. Do not call directly.
Declaration
Swift
static func cs_fromRaw(object: NSManagedObject) -> Self
-
Used internally by CoreStore. Do not call directly.
Declaration
Swift
static func cs_matches(object: NSManagedObject) -> Bool
-
Used internally by CoreStore. Do not call directly.
Declaration
Swift
func cs_id() -> NSManagedObjectID
-
Used internally by CoreStore. Do not call directly.
Declaration
Swift
func cs_toRaw() -> NSManagedObject
-
partialObject()
Extension methodReturns the
PartialObject
instance for the object, which acts as a fast, type-safe KVC interface forCoreStoreObject
.Declaration
Swift
public func partialObject() -> PartialObject<Self>
-
Relationship
Extension methodThe containing type for relationships.
Relationship
s can be anyCoreStoreObject
subclass.class Dog: CoreStoreObject { let master = Relationship.ToOne<Person>("master") } class Person: CoreStoreObject { let pets = Relationship.ToManyUnordered<Dog>("pets", inverse: { $0.master }) }
Important
Relationship
properties are required to be stored properties. Computed properties will be ignored, includinglazy
andweak
properties.Declaration
Swift
public typealias Relationship = RelationshipContainer<Self>
-
Transformable
Extension methodThe containing type for transformable properties.
Transformable
properties support types that conforms toNSCoding & NSCopying
.class Animal: CoreStoreObject { let species = Value.Required<String>("species", initial: "") let nickname = Value.Optional<String>("nickname") let color = Transformable.Optional<UIColor>("color") }
Important
Transformable
properties are required to be stored properties. Computed properties will be ignored, includinglazy
andweak
properties.Declaration
Swift
public typealias Transformable = TransformableContainer<Self>
-
Value
Extension methodThe containing type for value propertiess.
Value
properties support any type that conforms toImportableAttributeType
.class Animal: CoreStoreObject { let species = Value.Required<String>("species", initial: "") let nickname = Value.Optional<String>("nickname") let color = Transformable.Optional<UIColor>("color") }
Important
Value
properties are required to be stored properties. Computed properties will be ignored, includinglazy
andweak
properties.Declaration
Swift
public typealias Value = ValueContainer<Self>