Created
November 4, 2017 15:34
-
-
Save barbaramartina/a6a4263a3d9ecddfcf0f3acdd285ee05 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a persistent container with an specific description for the stores | |
private(set) lazy var container: NSPersistentContainer = { | |
let description = NSPersistentStoreDescription() | |
description.type = NSSQLiteStoreType | |
description.shouldInferMappingModelAutomatically = false | |
description.shouldMigrateStoreAutomatically = true | |
let container = NSPersistentContainer(name: CoreDataStackTheNewWay.modelName) | |
container.persistentStoreDescriptions = [description] | |
container.loadPersistentStores(completionHandler: { (storeDescription, error) in | |
if let error = error as NSError? { | |
fatalError("Unresolved error \(error), \(error.userInfo)") | |
} | |
}) | |
return container | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment