File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ struct SwiftUI_DaysApp: App {
1313 @State private var appSettings = AppSettings ( )
1414 private let sharedModelContainer : ModelContainer
1515
16+ #if DEBUG
1617 init ( ) {
1718 if ProcessInfo . processInfo. arguments. contains ( " UITest " ) {
1819 UIView . setAnimationsEnabled ( false )
@@ -29,6 +30,17 @@ struct SwiftUI_DaysApp: App {
2930 }
3031 }
3132 }
33+ #else
34+ init ( ) {
35+ let schema = Schema ( [ Item . self] )
36+ let modelConfiguration = ModelConfiguration ( schema: schema, isStoredInMemoryOnly: false )
37+ do {
38+ sharedModelContainer = try ModelContainer ( for: schema, configurations: [ modelConfiguration] )
39+ } catch {
40+ fatalError ( " Не смогли создать ModelContainer: \( error) " )
41+ }
42+ }
43+ #endif
3244
3345 var body : some Scene {
3446 WindowGroup {
You can’t perform that action at this time.
0 commit comments