// // Waterfall_UIApp.swift // Waterfall_UI // // Created by Jacky Jack on 06/01/2025. // import SwiftUI import SwiftData @main struct Waterfall_UIApp: App { let sdrSpectrum = SDRSpectrum() @Environment(\.scenePhase) private var scenePhase var sharedModelContainer: ModelContainer = { let schema = Schema([ Item.self, ]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { return try ModelContainer(for: schema, configurations: [modelConfiguration]) } catch { fatalError("Could not create ModelContainer: \(error)") } }() var body: some Scene { WindowGroup { ContentView() .environmentObject(sdrSpectrum) .onChange(of: scenePhase) { phase in if phase == .active { Task(priority: .userInitiated) { sdrSpectrum.startRunning() } } } } .modelContainer(sharedModelContainer) } }