Михаил Капелько 10 months ago
parent
commit
5fad16246a
1 changed files with 21 additions and 1 deletions
  1. +21
    -1
      src/App.swift

+ 21
- 1
src/App.swift View File

@@ -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 {


Loading…
Cancel
Save