CoreDataStackProvider
public struct CoreDataStackProvider
extension CoreDataStackProvider: Equatable
An instance of CoreDataStackProvider is responsible for creating instances of CoreDataStack.
Because the adding of the persistent store to the persistent store coordinator during initialization
of a CoreDataStack can take an unknown amount of time, you should not perform this operation on the main queue.
See this guide for more details.
Warning
You should not create instances ofCoreDataStack directly. Use a CoreDataStackProvider instead.
-
Describes the initialization options for a persistent store.
Declaration
Swift
public typealias PersistentStoreOptions = [AnyHashable : Any]
-
Describes default persistent store options.
Declaration
Swift
public static let defaultStoreOptions: PersistentStoreOptions -
The model for the stack that the factory produces.
Declaration
Swift
public let model: CoreDataModel -
A dictionary that specifies options for the store that the factory produces. The default value is
DefaultStoreOptions.Declaration
Swift
public let options: PersistentStoreOptions?
-
Declaration
Swift
public init(model: CoreDataModel, options: PersistentStoreOptions? = defaultStoreOptions)Parameters
modelThe model describing the stack.
optionsOptions for the persistent store.
Return Value
A new
CoreDataStackProviderinstance.
-
Initializes a new
CoreDataStackinstance using the factory’smodelandoptions.Warning
If a queue is provided, this operation is performed asynchronously on the specified queue, and the completion closure is executed asynchronously on the main queue. If
queueisnil, then this method and the completion closure execute synchronously on the current queue.Declaration
Swift
public func createStack(onQueue queue: DispatchQueue? = .global(qos: .userInitiated), completion: @escaping (CoreDataStack.StackResult) -> Void)Parameters
queueThe queue on which to initialize the stack. The default is a background queue with a “user initiated” quality of service class. If passing
nil, this method is executed synchronously on the queue from which the method was called.completionThe closure to be called once initialization is complete. If a queue is provided, this is called asynchronously on the main queue. Otherwise, this is executed on the thread from which the method was originally called.
View on GitHub
CoreDataStackProvider Structure Reference