import BusX import SwiftUI extension MeetupId { public struct V: View { @StateObject var isJoinAvailable = BusUI.Value(K.isJoinAvailable, false) @StateObject var isLoading = BusUI.Value(K.isLoading, false) @StateObject var join = BusUI.Button(K.join) @StateObject var textField = BusUI.TextField(K.textApp, K.textUI) let processors: [Any] public init() { processors = [ Bus.ConstDebounce(shouldResetText, 0.2, K.M, K.textApp), Bus.ConstDelay(shouldFinishLoading, 5, K.M, K.finishLoading), Bus.Sync(shouldEnableJoin, K.M, K.isJoinAvailable), Bus.Sync(shouldResetLoading, K.M, K.isLoading) ] } public var body: some View { VStack(spacing: 8) { HStack { TextField("Binding-3", value: $textField.v, formatter: BusUI.TextFieldSource()) .disabled(isLoading.v) .padding(8) .border( !isLoading.v ? Color.black : Color.gray, width: !isLoading.v ? 2 : 1 ) if isLoading.v { ProgressView() .padding(8) } } Button(action: join.v.send) { Text("Join") .padding(8) .border( isJoinAvailable.v ? Color.green : Color.gray, width: isJoinAvailable.v ? 2 : 1 ) } .disabled(!isJoinAvailable.v) } .frame(width: 320) .padding() .animation(.easeInOut(duration: 0.3)) } } }