jel/Jel/Controllers/DatamodelController.swift

26 lines
572 B
Swift

//
// DatamodelController.swift
// Jel
//
// Created by zerocool on 12/11/23.
//
import CoreData
struct DatamodelController {
static let shared = DatamodelController()
let container: NSPersistentContainer
init() {
container = NSPersistentContainer(name: "Model")
container.loadPersistentStores(completionHandler: {(storeDescription, error) in
if let error = error as NSError? {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
container.viewContext.automaticallyMergesChangesFromParent = true
}
}