Skip to content

Commit 366bd39

Browse files
committed
Поправил сборку в релизе
1 parent ff78653 commit 366bd39

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

SwiftUI-Days/SwiftUI_DaysApp.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)