CoreDataStore
public class CoreDataStore: PersistenceStore
Implementation fo the PersistenceStore
protocol using CoreData
-
Initialize a new CoreData persistence store
Declaration
Swift
public init(context: NSManagedObjectContext)
Parameters
context
The managed object context used for querying and
Return Value
An initialised instance of this class
-
Undocumented
Declaration
Swift
public class CoreDataStore: PersistenceStore
-
Create a new object of the given type.
Throws
If a invalid type was specified
Declaration
Swift
public func create<T>(type: Any.Type) throws -> T
Parameters
type
The type of which a new object should be created
Return Value
A newly created object of the given type
-
Delete objects of the given type which also match the predicate.
Throws
If an invalid type was specified
Declaration
Swift
public func delete(type: Any.Type, predicate: NSPredicate) throws
Parameters
type
The type of which objects should be deleted
predicate
The predicate used for matching objects to delete
-
Fetches all objects of a specific type which also match the predicate.
Throws
If an invalid type was specified
Declaration
Swift
public func fetchAll<T>(type: Any.Type, predicate: NSPredicate) throws -> [T]
Parameters
type
The type of which objects should be fetched
predicate
The predicate used for matching object to fetch
Return Value
An array of matching objects
-
Returns an array of names of properties the given type stores persistently.
This should omit any properties returned by
relationshipsFor(type:)
.Throws
If an invalid type was specified
Declaration
Swift
public func properties(for type: Any.Type) throws -> [String]
Parameters
type
The type of which properties should be returned for
Return Value
An array of property names representing system native types.
-
Returns an array of property names for any relationship the given type stores persistently.
Throws
If an invalid type was specified
Declaration
Swift
public func relationships(for type: Any.Type) throws -> [String]
Parameters
type
The type of which properties should be returned for
Return Value
An array of property names representing related entities.
-
Performs the actual save to the persistence store.
Throws
If any error occured during the save operationDeclaration
Swift
public func save() throws
-
Undocumented
Declaration
Swift
public class CoreDataStore: PersistenceStore
-
Undocumented
Declaration
Swift
public class CoreDataStore: PersistenceStore