25 lines
586 B
Swift
25 lines
586 B
Swift
//
|
|
// PersistenceController.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 7/28/25.
|
|
//
|
|
|
|
import CoreData
|
|
|
|
struct PersistenceController {
|
|
static let shared = PersistenceController()
|
|
|
|
let container: NSPersistentContainer
|
|
|
|
init() {
|
|
container = NSPersistentContainer(name: "DataModel")
|
|
container.loadPersistentStores { description, error in
|
|
if let error = error {
|
|
fatalError("Error loading Core Data stores: \(error)")
|
|
}
|
|
}
|
|
container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
|
|
}
|
|
}
|