diff options
author | Arturs Artamonovs <arturs.artamonovs@protonmail.com> | 2025-01-05 10:07:35 +0000 |
---|---|---|
committer | Arturs Artamonovs <arturs.artamonovs@protonmail.com> | 2025-01-05 10:07:35 +0000 |
commit | f923a3824561c6cf200c638e3d44d1cbf4adf7d8 (patch) | |
tree | cdf4d935e8be653a7d296d4cd48e06cffd3b376d /WaterfallFile_UI/WaterfallFile_UIApp.swift | |
parent | b999f85d83728bd7034e85f2e038bb9a6454b16a (diff) | |
download | PrySDR-f923a3824561c6cf200c638e3d44d1cbf4adf7d8.tar.gz PrySDR-f923a3824561c6cf200c638e3d44d1cbf4adf7d8.zip |
Waterfall: drawing from file initial implementatiom, visual version concept is ready
Diffstat (limited to 'WaterfallFile_UI/WaterfallFile_UIApp.swift')
-rw-r--r-- | WaterfallFile_UI/WaterfallFile_UIApp.swift | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/WaterfallFile_UI/WaterfallFile_UIApp.swift b/WaterfallFile_UI/WaterfallFile_UIApp.swift new file mode 100644 index 0000000..959fe55 --- /dev/null +++ b/WaterfallFile_UI/WaterfallFile_UIApp.swift @@ -0,0 +1,45 @@ +// +// WaterfallFile_UIApp.swift +// WaterfallFile_UI +// +// Created by Jacky Jack on 23/12/2024. +// + +import SwiftUI +import SwiftData + +@main +struct WaterfallFile_UIApp: App { + + let fileSpectrum = FileSpectrum() + + @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(fileSpectrum) + .onChange(of: scenePhase) { phase in + if phase == .active { + Task(priority: .userInitiated) { + fileSpectrum.startRunning() + } + } + } + } + .modelContainer(sharedModelContainer) + } +} |