LiteStack
Undocumented
-
The model used to create the managed object context.
Declaration
Swift
public let model: NSManagedObjectModel
-
The persistent store coordinator backing the managed object context.
Declaration
Swift
public let coordinator: NSPersistentStoreCoordinator
-
The main context that should be used for most operations.
Declaration
Swift
public let context: NSManagedObjectContext
-
LiteStack
encapsulates the setup of a core data stack, and provides a default managed object context for use. It also provides convenient defaults, and a convient method for creating private contexts back by the same persistent coordinator.Throws
If the model cannot be located or the persistent store cannot be added to the coordinator, we’ll throw an error.
Declaration
Swift
public init(modelName: String, bundle: NSBundle? = nil, storeLocation: NSURL? = nil, storeName: String? = nil, storeType: String = NSSQLiteStoreType, storeOptions: [NSObject: AnyObject]? = nil) throws
Parameters
modelName
The name of the model file.
bundle
The bundle where the
.momd
file can be found. Defaults toNSBundle.mainBundle()
.storeLocation
The location in which to store the database files. Defaults to the documents directory.
storeName
The name of the file for the store. Defaults to
modelName
.sqlite.storeType
The type of store to initialize the persistent store with. Defaults to
NSSQLiteStoreType
.storeOptions
The store options for the persistent store. Defaults to
NSMigratePersistentStoresAutomaticallyOption: true
andNSInferMappingModelAutomaticallyOption: true
for automatic light weight migrations.Return Value
A
CoreDataStack
initialized with the given parameters. -
Create a private context for doing work outside of the main context.
Declaration
Swift
public func privateContext() -> NSManagedObjectContext
Return Value
A new
NSManagedObjectContext
with a private concurrency type.