CoreDataStack
Encapsulates a Core Data stack. This predates NSPersistentContainer and it's basically the same.
@objc public class CoreDataStack: NSObject Inheritance#
NSObject
Initializers#
init(storeType:model:storeURL:concurrencyType:dispatchImmediately:)#
Create a new Core Data stack.
@objc public init(storeType: String, model: NSManagedObjectModel, storeURL: URL?, concurrencyType: NSManagedObjectContextConcurrencyType = .privateQueueConcurrencyType, dispatchImmediately: Bool = false) Parameters#
- storeType: Store type, such as NSSQLiteStoreType.
- model: model to be used for the stack.
- storeURL:
URLfor the store location. Optional. - concurrencyType: Default is
privateQueueConcurrencyType - dispatchImmediately: Used for testing.
Properties#
managedObjectContext#
@objc public private(set) var managedObjectContext: NSManagedObjectContext!persistentStoreCoordinator#
@objc public private(set) var persistentStoreCoordinator: NSPersistentStoreCoordinator!store#
@objc public private(set) var store: NSPersistentStore!storeType#
@objc public let storeType: StringstoreURL#
@objc public let storeURL: URL?useDispatchImmediately#
@objc public let useDispatchImmediately: Boolmodel#
@objc public let model: NSManagedObjectModelconcurrencyType#
@objc public let concurrencyType: NSManagedObjectContextConcurrencyTypeMethods#
deleteStore()#
Winds down the stack and deletes the store.
@objc public func deleteStore()