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 {