From 93c0be46148e59164e0a8fa5969a084c7a69879f Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 1 Aug 2023 14:06:01 -0500 Subject: [PATCH] updated radiobox for handler Signed-off-by: Matt Bruce --- .../RadioBoxGroupViewController.swift | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/VDSSample/ViewControllers/RadioBoxGroupViewController.swift b/VDSSample/ViewControllers/RadioBoxGroupViewController.swift index e0c6c2f..d72d09b 100644 --- a/VDSSample/ViewControllers/RadioBoxGroupViewController.swift +++ b/VDSSample/ViewControllers/RadioBoxGroupViewController.swift @@ -28,8 +28,10 @@ class RadioBoxGroupViewController: BaseViewController{ setupModel() } - override func setupForm() { + var actionLabel = Label() + override func setupForm(){ super.setupForm() + addFormRow(label: "Action", view: actionLabel) addFormRow(label: "Disabled", view: disabledSwitch) addFormRow(label: "Surface", view: surfacePickerSelectorView) addFormRow(label: "Strikethrough", view: strikeThroughSwitch) @@ -82,18 +84,11 @@ class RadioBoxGroupViewController: BaseViewController{ component.selectorModels = [radioBox1, radioBox2] - component - .publisher(for: .valueChanged) - .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) - + component.onChange = { [weak self] group in + let newText = "Selected:\r\(group.selectedHandler?.text ?? "none")" + self?.actionLabel.text = newText + } + //set UI values surfacePickerSelectorView.text = component.surface.rawValue disabledSwitch.isOn = component.disabled