Проверка шаблона шины для iOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 line
935B

  1. import BusX
  2. import SwiftUI
  3. struct V: View {
  4. @StateObject var isJoinAvailable = Cord.Receive("joinAvailable", false)
  5. @StateObject var join = Cord.Button("join")
  6. @StateObject var textF = Cord.TextField("text.app", "text.ui")
  7. let test = Bus.Processor("text.ui", "joinAvailable", MeetupId.onlyAllowJoin)
  8. var body: some View {
  9. VStack {
  10. HStack {
  11. Text("Check text field:")
  12. Text("'\(textF.value)'")
  13. .fontWeight(.bold)
  14. }
  15. TextField("Binding-3", value: $textF.value, formatter: TextFieldValueOwner())
  16. .padding(8)
  17. .border(Color.blue, width: 2)
  18. Button(action: join.press.send) {
  19. Text("Join")
  20. .padding(8)
  21. .border(
  22. isJoinAvailable.value ? Color.green : Color.gray,
  23. width: isJoinAvailable.value ? 4 : 1
  24. )
  25. }
  26. .disabled(!isJoinAvailable.value)
  27. }
  28. .frame(width: 320)
  29. .padding()
  30. }
  31. }