diff --git a/src/App.swift b/src/App.swift index e7dc8d4..bcad986 100644 --- a/src/App.swift +++ b/src/App.swift @@ -8,6 +8,10 @@ import UIKit struct Content: View { @State private var selectedId = "1" var ids = ["1", "2", "3", "4"] + + @StateObject var adates = BusUI.Value(Mic.K.activityDates, [String: Date]()) + var keys: [String] { Array(adates.v.keys) } + var body: some View { VStack { HStack { @@ -25,8 +29,8 @@ struct Content: View { Divider() .padding() List { - ForEach(ids, id: \.self) { - Text("\($0): TODO state") + ForEach(keys, id: \.self) { + Text("\($0): \(String(describing: adates.v[$0]))") } } } @@ -103,18 +107,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate } func testMic4() { - let ad1 = [ - "1": Date().addingTimeInterval(3), - "2": Date().addingTimeInterval(5), - ] - Bus.send(Mic.K.activityDates, ad1) - DispatchQueue.main.asyncAfter(deadline: .now() + 2) { - let ad2 = [ - "1": Date().addingTimeInterval(3), - "4": Date().addingTimeInterval(5), - ] - Bus.send(Mic.K.activityDates, ad2) + Bus.send( + Mic.K.activityDates, + [ + "1": Date().addingTimeInterval(3), + "2": Date().addingTimeInterval(5), + ] + ) } + + DispatchQueue.main.asyncAfter(deadline: .now() + 4) { + Bus.send( + Mic.K.activityDates, + [ + "1": Date().addingTimeInterval(2), + "4": Date().addingTimeInterval(5), + ] + ) + } + } }