44 lines
1.0 KiB
Swift
44 lines
1.0 KiB
Swift
//
|
|
// AutoCat2SUIApp.swift
|
|
// AutoCat2SUI
|
|
//
|
|
// Created by Selim Mustafaev on 24.07.2022.
|
|
//
|
|
|
|
import SwiftUI
|
|
import AutoCatCore
|
|
|
|
@main
|
|
struct AutoCat2SUIApp: App {
|
|
|
|
let storageService = StorageService.sharedNotWait
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
if Testing.isUITesting {
|
|
RootView(settings: getTestSettings())
|
|
.environment(\.managedObjectContext, storageService.context)
|
|
} else {
|
|
RootView(settings: getSettings())
|
|
.environment(\.managedObjectContext, storageService.context)
|
|
}
|
|
}
|
|
}
|
|
|
|
func getTestSettings() -> TestSettings {
|
|
guard let settings = MainSettings.shared as? TestSettings else {
|
|
fatalError("Error getting settings")
|
|
}
|
|
|
|
return settings
|
|
}
|
|
|
|
func getSettings() -> MainSettings {
|
|
guard let settings = MainSettings.shared as? MainSettings else {
|
|
fatalError("Error getting settings")
|
|
}
|
|
|
|
return settings
|
|
}
|
|
}
|