diff options
author | Arturs Artamonovs <arturs.artamonovs@protonmail.com> | 2025-01-17 09:27:56 +0000 |
---|---|---|
committer | Arturs Artamonovs <arturs.artamonovs@protonmail.com> | 2025-01-17 09:27:56 +0000 |
commit | 06a90001363fdcb542b531a74ed2c18f714f58c4 (patch) | |
tree | e0ae3092494e6136ec7479b0e9bda20ef930039b /Waterfall_UI/Waterfall_UIApp.swift | |
parent | a0d12ecbac8fe327d1dcd4580fee594e24d4191b (diff) | |
download | PrySDR-06a90001363fdcb542b531a74ed2c18f714f58c4.tar.gz PrySDR-06a90001363fdcb542b531a74ed2c18f714f58c4.zip |
waterfallui: data get processed and drawn, ui controlls are dummy
Diffstat (limited to 'Waterfall_UI/Waterfall_UIApp.swift')
-rw-r--r-- | Waterfall_UI/Waterfall_UIApp.swift | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Waterfall_UI/Waterfall_UIApp.swift b/Waterfall_UI/Waterfall_UIApp.swift new file mode 100644 index 0000000..6d9a13b --- /dev/null +++ b/Waterfall_UI/Waterfall_UIApp.swift @@ -0,0 +1,46 @@ +// +// 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) + } +} |