Update version
This commit is contained in:
@@ -114,6 +114,8 @@ class CoreDataStack: ObservableObject {
|
||||
return appGroupURL
|
||||
}
|
||||
|
||||
@Published private(set) var isLoaded = false
|
||||
|
||||
lazy var persistentContainer: NSPersistentContainer = {
|
||||
let container: NSPersistentContainer
|
||||
if Self.cloudKitEnabled {
|
||||
@@ -139,13 +141,16 @@ class CoreDataStack: ObservableObject {
|
||||
|
||||
container.persistentStoreDescriptions = [description]
|
||||
|
||||
container.loadPersistentStores { description, error in
|
||||
container.loadPersistentStores { [weak self] description, error in
|
||||
if let error = error as NSError? {
|
||||
// In production, handle this error appropriately
|
||||
print("Core Data failed to load: \(error), \(error.userInfo)")
|
||||
} else {
|
||||
print("Core Data loaded successfully at: \(description.url?.path ?? "unknown")")
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
self?.isLoaded = true
|
||||
}
|
||||
}
|
||||
|
||||
// Merge policy - remote changes win
|
||||
|
||||
Reference in New Issue
Block a user