From 454fbd9686590c454b288301d65cebd845b815f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Thu, 25 Jan 2024 19:17:25 +0300 Subject: [PATCH] d --- src/App.swift | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) 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), + ] + ) + } + } }