diff options
author | Arturs Artamonovs <arturs.artamonovs@protonmail.com> | 2024-07-02 10:07:49 +0100 |
---|---|---|
committer | Arturs Artamonovs <arturs.artamonovs@protonmail.com> | 2024-07-02 10:07:49 +0100 |
commit | cc5272cd4be2ab55fa8411790082be408b586be9 (patch) | |
tree | 8436c54cdeb94e6383607fe0028b09a19790e8d2 /LearnMapKit/LearnMapKitApp.swift | |
parent | 58d9d561df35f88884b2959d2cf322f1ee69e3cd (diff) | |
download | ADSBDecoder-cc5272cd4be2ab55fa8411790082be408b586be9.tar.gz ADSBDecoder-cc5272cd4be2ab55fa8411790082be408b586be9.zip |
Make ADSBDecoder more modular. Integrate into LearnMapKit
Diffstat (limited to 'LearnMapKit/LearnMapKitApp.swift')
-rw-r--r-- | LearnMapKit/LearnMapKitApp.swift | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/LearnMapKit/LearnMapKitApp.swift b/LearnMapKit/LearnMapKitApp.swift index eebb4b8..5fa170a 100644 --- a/LearnMapKit/LearnMapKitApp.swift +++ b/LearnMapKit/LearnMapKitApp.swift @@ -6,12 +6,53 @@ // import SwiftUI +import Collections + +//https://www.hackingwithswift.com/quick-start/swiftui/how-to-run-code-when-your-app-launches + + @main struct LearnMapKitApp: App { + + @State var queue: Deque<ADSBLocation> = [] + + @StateObject private var flightState = FlightState() + + init() { + print("Init app") + var update_postions: Deque<ADSBLocation> = [] + DispatchQueue.global(qos: .background).sync { + print("Dispatch") + //var count = 0 + + + //let ADSBtask = ADSBRunner() + //queue.append(MapADSBData(lat: 0.0, long: 0.0, alt: 1)) + /* + let timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { timer in + print("Timer fired! \(count)") + ADSBtask.runFromFile() + update_postions.append(MapADSBData(lat: 0.0, long: 0.0, alt: 1)) + print(update_postions.count) + count += 1 + }*/ + print("Exit dispatch") + } + + //push all new data to state queue from a runner + DispatchQueue.global(qos: .background).sync { + // Update the UI on the main thread + let c = queue.count + } + } + + + var body: some Scene { WindowGroup { - ContentView() - } + ContentView(pos_queue: $queue) + }.environmentObject(flightState) } + } |