From 5fad16246ad730a81365302d8303e1d2face2e4f 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: Tue, 13 Feb 2024 15:33:27 +0300 Subject: [PATCH] d --- src/App.swift | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/App.swift b/src/App.swift index c052145..f4b438e 100644 --- a/src/App.swift +++ b/src/App.swift @@ -5,12 +5,32 @@ import MicX import SwiftUI import UIKit + +class SingularityState { + var value: String? +} + +func checkSingularity(_ s: String) -> String? { + var subs = [AnyCancellable]() + let ss = SingularityState() + + Bus.receiveSync( + &subs, + ["check1"], + { [weak ss] (_, v: String) in ss?.value = v } + ) + + Bus.send("check1", "cs\(s)") + + return ss.value +} + struct Now: View { @State var refresh = false let tm = Timer.publish(every: 0.5, on: .current, in: .common).autoconnect() var now: String { - "Now: " + String(describing: Int(Date().timeIntervalSince1970)) + "Now: " + String(describing: Int(Date().timeIntervalSince1970)) + String(describing: checkSingularity("1")) } var body: some View {