CoreDataStack
Encapsulates a Core Data stack. This predates NSPersistentContainer
and it's basically the same.
@objc public class CoreDataStack: NSObject
#
InheritanceNSObject
#
Initializersinit(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:
URL
for the store location. Optional. - concurrencyType: Default is
privateQueueConcurrencyType
- dispatchImmediately: Used for testing.
#
PropertiesmanagedObjectContext
#
@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: String
storeURL
#
@objc public let storeURL: URL?
useDispatchImmediately
#
@objc public let useDispatchImmediately: Bool
model
#
@objc public let model: NSManagedObjectModel
concurrencyType
#
@objc public let concurrencyType: NSManagedObjectContextConcurrencyType
#
MethodsdeleteStore()
#
Winds down the stack and deletes the store.
@objc public func deleteStore()