updated onChange
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
2bf7d2e1ab
commit
a870ef5de1
@ -145,11 +145,15 @@ class DropdownSelectViewController: BaseViewController<DropdownSelect> {
|
|||||||
component.errorText = "Enter a valid address."
|
component.errorText = "Enter a valid address."
|
||||||
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
|
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
|
||||||
component.options = moreOptions
|
component.options = moreOptions
|
||||||
component.selectId = 0
|
|
||||||
|
|
||||||
/// callback to know which option chose
|
/// callback to know which option chose
|
||||||
component.onDropdownItemSelect = { option in
|
component.onItemSelected = { index, option in
|
||||||
print("selected option text: \(option.text)")
|
print("selected index: \(index) text: \(option.text) value: \(option.value)")
|
||||||
|
}
|
||||||
|
|
||||||
|
component.onChange = { dropdown in
|
||||||
|
guard let option = dropdown.selectedItem, let index = dropdown.selectId else { print("nothing selected"); return }
|
||||||
|
print("selected index: \(index) text: \(option.text) value: \(option.value)")
|
||||||
}
|
}
|
||||||
|
|
||||||
//setup UI
|
//setup UI
|
||||||
|
|||||||
@ -119,21 +119,20 @@ class InputFieldViewController: BaseViewController<InputField> {
|
|||||||
func setupModel() {
|
func setupModel() {
|
||||||
component.fieldType = .text
|
component.fieldType = .text
|
||||||
component.width = 328
|
component.width = 328
|
||||||
|
component.text = "Starting Text"
|
||||||
component.labelText = "Street Address"
|
component.labelText = "Street Address"
|
||||||
component.helperText = "For example: 123 Verizon St"
|
component.helperText = "For example: 123 Verizon St"
|
||||||
component.errorText = "Enter a valid address."
|
component.errorText = "Enter a valid address."
|
||||||
component.successText = "Good job entering a valid address!"
|
component.successText = "Good job entering a valid address!"
|
||||||
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
|
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
|
||||||
|
|
||||||
component
|
component.onChange = { component in
|
||||||
.publisher(for: .valueChanged)
|
if let text = component.value {
|
||||||
.sink { component in
|
print("text entry: \(text)")
|
||||||
if let text = component.value {
|
} else {
|
||||||
print("text entry: \(text)")
|
print("text entry: null")
|
||||||
} else {
|
}
|
||||||
print("text entry: null")
|
}
|
||||||
}
|
|
||||||
}.store(in: &subscribers)
|
|
||||||
|
|
||||||
//setup UI
|
//setup UI
|
||||||
surfacePickerSelectorView.text = component.surface.rawValue
|
surfacePickerSelectorView.text = component.surface.rawValue
|
||||||
|
|||||||
@ -131,15 +131,14 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
|||||||
component.helperText = "For example: 123 Verizon St"
|
component.helperText = "For example: 123 Verizon St"
|
||||||
component.errorText = "Enter a valid address."
|
component.errorText = "Enter a valid address."
|
||||||
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
|
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
|
||||||
component
|
|
||||||
.publisher(for: .valueChanged)
|
component.onChange = { component in
|
||||||
.sink { component in
|
if let text = component.value {
|
||||||
// if let text = component.value {
|
print("text entry: \(text)")
|
||||||
// print("text entry: \(text)")
|
} else {
|
||||||
// } else {
|
print("text entry: null")
|
||||||
// print("text entry: null")
|
}
|
||||||
// }
|
}
|
||||||
}.store(in: &subscribers)
|
|
||||||
|
|
||||||
//setup UI
|
//setup UI
|
||||||
surfacePickerSelectorView.text = component.surface.rawValue
|
surfacePickerSelectorView.text = component.surface.rawValue
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user