|
|
@@ -1,27 +1,32 @@ |
|
|
|
import SwiftUI |
|
|
|
|
|
|
|
struct V: View { |
|
|
|
@StateObject var tf = Cord.TextField("text.app", "text.ui") |
|
|
|
@StateObject var vm = VM() |
|
|
|
@StateObject var isJoinAvailable = Cord.ReadOnly("joinAvailable", false) |
|
|
|
@StateObject var join = Cord.Button("join") |
|
|
|
@StateObject var textF = Cord.TextField("text.app", "text.ui") |
|
|
|
let test = Bus.Processor("text.ui", "joinAvailable", MeetupId.onlyAllowJoin) |
|
|
|
|
|
|
|
var body: some View { |
|
|
|
VStack { |
|
|
|
HStack { |
|
|
|
Text("Check text field:") |
|
|
|
Text("'\(tf.value)'") |
|
|
|
Text("'\(textF.value)'") |
|
|
|
.fontWeight(.bold) |
|
|
|
} |
|
|
|
|
|
|
|
TextField("Binding-3", value: $tf.value, formatter: TextFieldValueOwner()) |
|
|
|
TextField("Binding-3", value: $textF.value, formatter: TextFieldValueOwner()) |
|
|
|
.padding(8) |
|
|
|
.border(Color.blue, width: 2) |
|
|
|
|
|
|
|
Button(action: vm.join.send) { |
|
|
|
Button(action: join.press.send) { |
|
|
|
Text("Join") |
|
|
|
.padding(8) |
|
|
|
.border(vm.isJoinAvailable ? Color.green : Color.red, width: 4) |
|
|
|
.border( |
|
|
|
isJoinAvailable.value ? Color.green : Color.gray, |
|
|
|
width: isJoinAvailable.value ? 4 : 1 |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
.disabled(!isJoinAvailable.value) |
|
|
|
} |
|
|
|
.frame(width: 320) |
|
|
|
.padding() |
|
|
|