Михаил Капелько 9 miesięcy temu
rodzic
commit
5fad16246a
1 zmienionych plików z 21 dodań i 1 usunięć
  1. +21
    -1
      src/App.swift

+ 21
- 1
src/App.swift Wyświetl plik

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


Ładowanie…
Anuluj
Zapisz