Проверка шаблона шины для 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.

MeetupId.V.swift 1.5KB

11 months ago
11 months ago
10 months ago
11 months ago
10 months ago
10 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import BusX
  2. import SwiftUI
  3. extension MeetupId {
  4. public struct V: View {
  5. @StateObject var isJoinAvailable = BusUI.Value(K.isJoinAvailable, false)
  6. @StateObject var isLoading = BusUI.Value(K.isLoading, false)
  7. @StateObject var join = BusUI.Button(K.join)
  8. @StateObject var textField = BusUI.TextField(K.textApp, K.textUI)
  9. let processors: [Any]
  10. public init() {
  11. processors = [
  12. Bus.ConstDebounce(shouldResetText, 0.2, K.M, K.textApp),
  13. Bus.ConstDelay(shouldFinishLoading, 5, K.M, K.finishLoading),
  14. Bus.Sync(shouldEnableJoin, K.M, K.isJoinAvailable),
  15. Bus.Sync(shouldResetLoading, K.M, K.isLoading)
  16. ]
  17. }
  18. public var body: some View {
  19. VStack(spacing: 8) {
  20. HStack {
  21. TextField("Binding-3", value: $textField.v, formatter: BusUI.TextFieldSource())
  22. .disabled(isLoading.v)
  23. .padding(8)
  24. .border(
  25. !isLoading.v ? Color.black : Color.gray,
  26. width: !isLoading.v ? 2 : 1
  27. )
  28. if isLoading.v {
  29. ProgressView()
  30. .padding(8)
  31. }
  32. }
  33. Button(action: join.v.send) {
  34. Text("Join")
  35. .padding(8)
  36. .border(
  37. isJoinAvailable.v ? Color.green : Color.gray,
  38. width: isJoinAvailable.v ? 2 : 1
  39. )
  40. }
  41. .disabled(!isJoinAvailable.v)
  42. }
  43. .frame(width: 320)
  44. .padding()
  45. .animation(.easeInOut(duration: 0.3))
  46. }
  47. }
  48. }