Проверка шаблона шины для iOS

42 lines
1.1KB

  1. import BusX
  2. import CordX
  3. import SwiftUI
  4. extension MeetupId {
  5. public struct V: View {
  6. @StateObject var fmt = MeetupId.Formatter(K.textUI, K.textApp)
  7. @StateObject var isJA = Cord.Receive(K.isJoinAvailable, false)
  8. @StateObject var join = Cord.Button(K.join)
  9. @StateObject var txtF = Cord.TextField(K.textApp, K.textUI)
  10. let joinA = Bus.Processor(shouldEnableJoin, K.M, K.isJoinAvailable)
  11. public init() { }
  12. public var body: some View {
  13. VStack {
  14. HStack {
  15. Text("Check text field:")
  16. Text("'\(txtF.value)'")
  17. .fontWeight(.bold)
  18. }
  19. TextField("Binding-3", value: $txtF.value, formatter: Cord.TextFieldValueOwner())
  20. .padding(8)
  21. .border(Color.blue, width: 2)
  22. Button(action: join.press.send) {
  23. Text("Join")
  24. .padding(8)
  25. .border(
  26. isJA.value ? Color.green : Color.gray,
  27. width: isJA.value ? 4 : 1
  28. )
  29. }
  30. .disabled(!isJA.value)
  31. }
  32. .frame(width: 320)
  33. .padding()
  34. }
  35. }
  36. }