From 37da8449388fce53dfb50b8138f5017950824c4f Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Sun, 6 Oct 2024 00:20:31 +0200 Subject: [PATCH] Implemented the "container" property for the PiperApp app in the app target. --- Piper/Sources/App/PiperApp.swift | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Piper/Sources/App/PiperApp.swift b/Piper/Sources/App/PiperApp.swift index b08661e..6999af0 100644 --- a/Piper/Sources/App/PiperApp.swift +++ b/Piper/Sources/App/PiperApp.swift @@ -14,16 +14,14 @@ struct PiperApp: App { // MARK: Properties - var sharedModelContainer: ModelContainer = { - let schema = Schema([ - Item.self, - ]) - let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) - + private var container = { do { - return try ModelContainer(for: schema, configurations: [modelConfiguration]) + return try ModelContainer( + for: .entities, + configurations: [ModelConfiguration()] + ) } catch { - fatalError("Could not create ModelContainer: \(error)") + fatalError("ERROR: ModelContainer has not been created => \(error)") } }()