updated to include alerts on events/clicks
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
e9bee80aa3
commit
832890abf7
@ -81,7 +81,12 @@ class ButtonViewController: BaseViewController {
|
||||
|
||||
button
|
||||
.publisher(for: .touchUpInside)
|
||||
.sink { control in
|
||||
.sink { [weak self] control in
|
||||
let alertController:UIAlertController = UIAlertController(title: "Alert",
|
||||
message: "\(control.text!) Clicked",
|
||||
preferredStyle: UIAlertController.Style.alert)
|
||||
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler:nil))
|
||||
self?.present(alertController, animated: true)
|
||||
print("clicked me")
|
||||
}.store(in: &subscribers)
|
||||
|
||||
|
||||
@ -78,12 +78,16 @@ class CheckboxGroupViewController: BaseViewController {
|
||||
|
||||
checkboxGroup
|
||||
.publisher(for: .valueChanged)
|
||||
.sink { group in
|
||||
.sink { [weak self] group in
|
||||
let selected = group.selectedHandlers?
|
||||
.compactMap{$0.labelText}
|
||||
.joined(separator: ", ") ?? "none"
|
||||
.compactMap{"\($0.labelText!)"}
|
||||
.joined(separator: "\r") ?? "none selected"
|
||||
|
||||
print("Selected: \(selected)")
|
||||
let alertController:UIAlertController = UIAlertController(title: "Alert",
|
||||
message: "Selected Checkboxes:\r\(selected)",
|
||||
preferredStyle: UIAlertController.Style.alert)
|
||||
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler:nil))
|
||||
self?.present(alertController, animated: true)
|
||||
}.store(in: &subscribers)
|
||||
|
||||
//setup UI
|
||||
|
||||
@ -76,7 +76,12 @@ class CheckboxViewController: BaseViewController {
|
||||
|
||||
checkbox
|
||||
.publisher(for: .valueChanged)
|
||||
.sink { checkbox in
|
||||
.sink { [weak self] checkbox in
|
||||
let alertController:UIAlertController = UIAlertController(title: "Alert",
|
||||
message: "\(checkbox.labelText!): \(checkbox.isSelected)",
|
||||
preferredStyle: UIAlertController.Style.alert)
|
||||
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler:nil))
|
||||
self?.present(alertController, animated: true)
|
||||
print("checkbox selected: \(checkbox.isSelected)")
|
||||
}.store(in: &subscribers)
|
||||
|
||||
|
||||
@ -29,8 +29,8 @@ class MenuViewController: UITableViewController {
|
||||
MenuComponent(title: "Checkbox", viewController: CheckboxViewController.self),
|
||||
MenuComponent(title: "CheckboxGroup", viewController: CheckboxGroupViewController.self),
|
||||
MenuComponent(title: "Label", viewController: LabelViewController.self),
|
||||
MenuComponent(title: "RadioButtonGroup", viewController: RadioButtonViewController.self),
|
||||
MenuComponent(title: "RadioBoxGroup", viewController: RadioBoxGroupViewController.self),
|
||||
MenuComponent(title: "RadioButtonGroup", viewController: RadioButtonViewController.self),
|
||||
MenuComponent(title: "RadioSwatchGroup", viewController: RadioSwatchGroupViewController.self),
|
||||
MenuComponent(title: "TextEntryField", viewController: TextEntryFieldViewController.self),
|
||||
MenuComponent(title: "TextLink", viewController: TextLinkViewController.self),
|
||||
|
||||
@ -90,7 +90,13 @@ class RadioBoxGroupViewController: BaseViewController {
|
||||
|
||||
radioBoxGroup
|
||||
.publisher(for: .valueChanged)
|
||||
.sink { group in
|
||||
.sink { [weak self] group in
|
||||
let alertController:UIAlertController = UIAlertController(title: "Alert",
|
||||
message: "Selected:\r\(group.selectedHandler?.text ?? "none")",
|
||||
preferredStyle: UIAlertController.Style.alert)
|
||||
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler:nil))
|
||||
self?.present(alertController, animated: true)
|
||||
|
||||
print("Selected: \(group.selectedHandler?.text ?? "none")")
|
||||
}.store(in: &subscribers)
|
||||
|
||||
|
||||
@ -85,7 +85,13 @@ class RadioButtonViewController: BaseViewController {
|
||||
|
||||
radioButtonGroup
|
||||
.publisher(for: .valueChanged)
|
||||
.sink { group in
|
||||
.sink { [weak self] group in
|
||||
let alertController:UIAlertController = UIAlertController(title: "Alert",
|
||||
message: "Selected:\r\(group.selectedHandler?.labelText ?? "none")",
|
||||
preferredStyle: UIAlertController.Style.alert)
|
||||
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler:nil))
|
||||
self?.present(alertController, animated: true)
|
||||
|
||||
print("Selected: \(group.selectedHandler?.labelText ?? "none")")
|
||||
}.store(in: &subscribers)
|
||||
|
||||
|
||||
@ -61,7 +61,12 @@ class TextLinkCaretViewController: BaseViewController {
|
||||
|
||||
textLinkCaret
|
||||
.publisher(for: .touchUpInside)
|
||||
.sink { control in
|
||||
.sink { [weak self] control in
|
||||
let alertController:UIAlertController = UIAlertController(title: "Alert",
|
||||
message: "\(control.text!) Clicked",
|
||||
preferredStyle: UIAlertController.Style.alert)
|
||||
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler:nil))
|
||||
self?.present(alertController, animated: true)
|
||||
print("clicked me")
|
||||
}.store(in: &subscribers)
|
||||
|
||||
|
||||
@ -61,7 +61,12 @@ class TextLinkViewController: BaseViewController {
|
||||
|
||||
textLink
|
||||
.publisher(for: .touchUpInside)
|
||||
.sink { control in
|
||||
.sink { [weak self] control in
|
||||
let alertController:UIAlertController = UIAlertController(title: "Alert",
|
||||
message: "\(control.text!) Clicked",
|
||||
preferredStyle: UIAlertController.Style.alert)
|
||||
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler:nil))
|
||||
self?.present(alertController, animated: true)
|
||||
print("clicked me")
|
||||
}.store(in: &subscribers)
|
||||
|
||||
|
||||
@ -67,10 +67,16 @@ class ToggleViewController: BaseViewController {
|
||||
//add textFormStackView to main form
|
||||
formStackView.addArrangedSubview(textFormStackView)
|
||||
|
||||
toggle.publisher(for: .valueChanged).sink { toggle in
|
||||
print("toggle changed: \(toggle.isOn)")
|
||||
}.store(in: &subscribers)
|
||||
|
||||
toggle.publisher(for: .valueChanged)
|
||||
.sink { [weak self] toggle in
|
||||
let alertController:UIAlertController = UIAlertController(title: "Alert",
|
||||
message: "Toggle Value: \(toggle.isOn)",
|
||||
preferredStyle: UIAlertController.Style.alert)
|
||||
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler:nil))
|
||||
self?.present(alertController, animated: true)
|
||||
print("toggle changed: \(toggle.isOn)")
|
||||
}.store(in: &subscribers)
|
||||
|
||||
showTextSwitch
|
||||
.publisher(for: .valueChanged)
|
||||
.sink { [weak self] sender in
|
||||
|
||||
Loading…
Reference in New Issue
Block a user