From 674641e84ec4d477fb64971e4bbeeed363ae45c1 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Thu, 30 Mar 2023 19:52:21 +0530 Subject: [PATCH 01/10] Notification button position changes --- .../ViewControllers/NotificationViewController.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift index 2700606..3a6068c 100644 --- a/VDSSample/ViewControllers/NotificationViewController.swift +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -24,11 +24,15 @@ class NotificationViewController: BaseViewController { let secondButtonDefaultText = "Button 2" lazy var notificationTypePickerSelectorView = { - PickerSelectorView(title: "Info", + PickerSelectorView(title: "info", picker: self.picker, items: Notification.NotificationStyle.allCases) }() + lazy var buttonPositionTypePickerSelectorView = { + PickerSelectorView(title: "bottom", picker: self.picker, items: Notification.ButtonsPosition.allCases) + }() + override func viewDidLoad() { super.viewDidLoad() @@ -50,6 +54,7 @@ class NotificationViewController: BaseViewController { func setupForm() { addFormRow(label: "Surface", view: surfacePickerSelectorView) addFormRow(label: "Style", view: notificationTypePickerSelectorView) + addFormRow(label: "Button Position", view: buttonPositionTypePickerSelectorView) addFormRow(label: "Title", view: titleTextField) addFormRow(label: "SubTitle", view: subTitleTextField) addFormRow(label: "Hide Button Group", view: buttonGroupToggle) @@ -104,6 +109,9 @@ class NotificationViewController: BaseViewController { self?.notificationView.type = item } + buttonPositionTypePickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.notificationView.buttonPosition = item + } } func setupButtons(with firstButtonText: String? = nil, secondButtonText: String? = nil) { From 29c3a2027a9322b40e843941b33a5f70c83401e9 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 30 Mar 2023 10:14:39 -0500 Subject: [PATCH 02/10] updated --- VDSSample/ViewControllers/CheckboxViewController.swift | 2 +- VDSSample/ViewControllers/MenuViewController.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VDSSample/ViewControllers/CheckboxViewController.swift b/VDSSample/ViewControllers/CheckboxViewController.swift index 3682077..3325694 100644 --- a/VDSSample/ViewControllers/CheckboxViewController.swift +++ b/VDSSample/ViewControllers/CheckboxViewController.swift @@ -19,7 +19,7 @@ class CheckboxViewController: BaseViewController { var errorTextField = TextField() var showErrorSwitch = Toggle() - var checkbox = SoloCheckbox() + var checkbox = Checkbox() override func viewDidLoad() { super.viewDidLoad() diff --git a/VDSSample/ViewControllers/MenuViewController.swift b/VDSSample/ViewControllers/MenuViewController.swift index cc76ee3..0777d93 100644 --- a/VDSSample/ViewControllers/MenuViewController.swift +++ b/VDSSample/ViewControllers/MenuViewController.swift @@ -79,7 +79,7 @@ class MenuViewController: UITableViewController { MenuComponent(title: "Icon", completed: true, viewController: IconViewController.self), MenuComponent(title: "InputField", completed: false, viewController: InputFieldViewController.self), MenuComponent(title: "Label", completed: true, viewController: LabelViewController.self), - MenuComponent(title: "Line", completed: false, viewController: LineViewController.self), + MenuComponent(title: "Line", completed: true, viewController: LineViewController.self), MenuComponent(title: "Notification", completed: false, viewController: NotificationViewController.self), MenuComponent(title: "RadioBoxGroup", completed: true, viewController: RadioBoxGroupViewController.self), MenuComponent(title: "RadioButtonGroup", completed: true, viewController: RadioButtonViewController.self), From 4aa7c867a7447b42f5a1b840ba53732f595b33d2 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 30 Mar 2023 10:40:02 -0500 Subject: [PATCH 03/10] refactored names Signed-off-by: Matt Bruce --- .../ViewControllers/NotificationViewController.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift index 9c8572d..4e62b3d 100644 --- a/VDSSample/ViewControllers/NotificationViewController.swift +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -36,8 +36,8 @@ class NotificationViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() - notificationView.titleText = titleDefaultText - notificationView.subTitleText = subtitleDefaultText + notificationView.title = titleDefaultText + notificationView.subTitle = subtitleDefaultText titleTextField.text = titleDefaultText subTitleTextField.text = subtitleDefaultText @@ -63,15 +63,15 @@ class NotificationViewController: BaseViewController { addFormRow(label: "Second Button Text", view: secondButtonTextField) notificationView.onCloseClick = { notification in - print("onCloseClick: \(notification.titleText)") + print("onCloseClick: \(notification.title)") } titleTextField.textPublisher.sink { newString in - self.notificationView.titleText = newString + self.notificationView.title = newString }.store(in: &subscribers) subTitleTextField.textPublisher.sink { newString in - self.notificationView.subTitleText = newString + self.notificationView.subTitle = newString }.store(in: &subscribers) buttonGroupToggle.publisher(for: .valueChanged).sink { [weak self] toggle in From b196cb590c3140e5c4a9ce8dbe27dfa146f2c9f8 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Thu, 30 Mar 2023 23:12:57 +0530 Subject: [PATCH 04/10] Remaning params --- VDSSample/ViewControllers/NotificationViewController.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift index 4e62b3d..87fa96a 100644 --- a/VDSSample/ViewControllers/NotificationViewController.swift +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -30,7 +30,7 @@ class NotificationViewController: BaseViewController { }() lazy var buttonPositionTypePickerSelectorView = { - PickerSelectorView(title: "bottom", picker: self.picker, items: Notification.ButtonsPosition.allCases) + PickerSelectorView(title: "bottom", picker: self.picker, items: Notification.ButtonsLayout.allCases) }() override func viewDidLoad() { @@ -54,7 +54,7 @@ class NotificationViewController: BaseViewController { func setupForm() { addFormRow(label: "Surface", view: surfacePickerSelectorView) addFormRow(label: "Style", view: notificationTypePickerSelectorView) - addFormRow(label: "Button Position", view: buttonPositionTypePickerSelectorView) + addFormRow(label: "Button Layout", view: buttonPositionTypePickerSelectorView) addFormRow(label: "Title", view: titleTextField) addFormRow(label: "SubTitle", view: subTitleTextField) addFormRow(label: "Hide Button Group", view: buttonGroupToggle) @@ -114,7 +114,7 @@ class NotificationViewController: BaseViewController { } buttonPositionTypePickerSelectorView.onPickerDidSelect = { [weak self] item in - self?.notificationView.buttonPosition = item + self?.notificationView.layout = item } } From 706005fc66192a878dae919e11113067c8befa81 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 30 Mar 2023 17:24:36 -0500 Subject: [PATCH 05/10] updated for item setting Signed-off-by: Matt Bruce --- VDSSample/Protocols/PickerBase.swift | 8 ++++++++ .../NotificationViewController.swift | 14 +++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/VDSSample/Protocols/PickerBase.swift b/VDSSample/Protocols/PickerBase.swift index d589d37..201b8d4 100644 --- a/VDSSample/Protocols/PickerBase.swift +++ b/VDSSample/Protocols/PickerBase.swift @@ -56,6 +56,7 @@ public class PickerSelectorView: UIStackView, Picker updateSelectedIndex() } } + public var items: [EnumType] { didSet { selectedIndex = 0 } } @@ -117,6 +118,13 @@ public class PickerSelectorView: UIStackView, Picker return label } + public func set(item: EnumType) { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.001) { [weak self] in + guard let self else { return } + self.text = "\(item.rawValue)" + } + } + private func title(for row: Int) -> String { guard let item = items[row].rawValue as? String else { return "" } return item diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift index 4e62b3d..dae2c80 100644 --- a/VDSSample/ViewControllers/NotificationViewController.swift +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -29,8 +29,8 @@ class NotificationViewController: BaseViewController { items: Notification.NotificationStyle.allCases) }() - lazy var buttonPositionTypePickerSelectorView = { - PickerSelectorView(title: "bottom", picker: self.picker, items: Notification.ButtonsPosition.allCases) + lazy var layoutTypePickerSelectorView = { + PickerSelectorView(title: "vertical", picker: self.picker, items: Notification.Layout.allCases) }() override func viewDidLoad() { @@ -54,7 +54,7 @@ class NotificationViewController: BaseViewController { func setupForm() { addFormRow(label: "Surface", view: surfacePickerSelectorView) addFormRow(label: "Style", view: notificationTypePickerSelectorView) - addFormRow(label: "Button Position", view: buttonPositionTypePickerSelectorView) + addFormRow(label: "Layout", view: layoutTypePickerSelectorView) addFormRow(label: "Title", view: titleTextField) addFormRow(label: "SubTitle", view: subTitleTextField) addFormRow(label: "Hide Button Group", view: buttonGroupToggle) @@ -113,8 +113,12 @@ class NotificationViewController: BaseViewController { self?.notificationView.type = item } - buttonPositionTypePickerSelectorView.onPickerDidSelect = { [weak self] item in - self?.notificationView.buttonPosition = item + layoutTypePickerSelectorView.onPickerDidSelect = { [weak self] item in + guard let self else { return } + self.notificationView.layout = item + if self.notificationView.layout != item { + self.layoutTypePickerSelectorView.set(item: self.notificationView.layout) + } } } From 9d8096258eda5f42be45cea7f7c49368aa1c95cb Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Fri, 31 Mar 2023 12:26:26 +0530 Subject: [PATCH 06/10] Adding - Notification close button toggle --- .../ViewControllers/NotificationViewController.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift index dae2c80..68c3381 100644 --- a/VDSSample/ViewControllers/NotificationViewController.swift +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -17,6 +17,7 @@ class NotificationViewController: BaseViewController { let buttonGroupToggle = Toggle() let firstButtonTextField = TextField() let secondButtonTextField = TextField() + let hideCloseButtonToggle = Toggle() let titleDefaultText = "This is title" let subtitleDefaultText = "This is subtitle" @@ -26,7 +27,7 @@ class NotificationViewController: BaseViewController { lazy var notificationTypePickerSelectorView = { PickerSelectorView(title: "info", picker: self.picker, - items: Notification.NotificationStyle.allCases) + items: Notification.Style.allCases) }() lazy var layoutTypePickerSelectorView = { @@ -58,6 +59,7 @@ class NotificationViewController: BaseViewController { addFormRow(label: "Title", view: titleTextField) addFormRow(label: "SubTitle", view: subTitleTextField) addFormRow(label: "Hide Button Group", view: buttonGroupToggle) + addFormRow(label: "Hide Close Button", view: hideCloseButtonToggle) addFormRow(label: "Button Action", view: label) addFormRow(label: "First Button Text", view: firstButtonTextField) addFormRow(label: "Second Button Text", view: secondButtonTextField) @@ -101,6 +103,10 @@ class NotificationViewController: BaseViewController { self.setupButtons(secondButtonText: newString) } }.store(in: &subscribers) + + hideCloseButtonToggle.publisher(for: .valueChanged).sink(receiveValue: { [weak self] toggle in + self?.notificationView.hideCloseButton = toggle.isOn + }).store(in: &subscribers) } func setupPicker() { From e6fa8a5930db4fa7d904f8cfb6a1f0acabfc559d Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 3 Apr 2023 10:16:06 -0500 Subject: [PATCH 07/10] move to onChange for controls Signed-off-by: Matt Bruce --- .../ButtonGroupViewController.swift | 16 ++-- .../ButtonViewController.swift | 12 +-- .../CheckBoxGroupViewController.swift | 46 ++++----- .../CheckboxViewController.swift | 48 +++++----- .../InputFieldViewController.swift | 52 +++++------ .../ViewControllers/LabelViewController.swift | 10 +- .../NotificationViewController.swift | 5 +- .../RadioBoxGroupViewController.swift | 16 ++-- .../RadioButtonViewController.swift | 38 ++++---- .../RadioSwatchGroupViewController.swift | 32 +++---- .../TextAreaViewController.swift | 36 +++---- .../TextLinkCaretViewController.swift | 10 +- .../TextLinkViewController.swift | 12 +-- .../TileContainerViewController.swift | 56 +++++------ .../TileletViewController.swift | 93 +++++++++---------- .../ToggleViewController.swift | 45 ++++----- 16 files changed, 227 insertions(+), 300 deletions(-) diff --git a/VDSSample/ViewControllers/ButtonGroupViewController.swift b/VDSSample/ViewControllers/ButtonGroupViewController.swift index e93d2ff..29663d6 100644 --- a/VDSSample/ViewControllers/ButtonGroupViewController.swift +++ b/VDSSample/ViewControllers/ButtonGroupViewController.swift @@ -112,15 +112,13 @@ class ButtonGroupViewController: BaseViewController { addFormRow(label: "Width", view: widthTextField) addFormRow(label: "Row Quantity", view: rowQuantitySelectorView) addFormRow(label: "Percentage (1-100)", view: percentageTextField) - - disabledSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.largeLabel.disabled = sender.isOn - self?.smallLabel.disabled = sender.isOn - self?.largeButtonGroup.disabled = sender.isOn - self?.smallButtonGroup.disabled = sender.isOn - }.store(in: &subscribers) + + disabledSwitch.onChange = { [weak self] sender in + self?.largeLabel.disabled = sender.isOn + self?.smallLabel.disabled = sender.isOn + self?.largeButtonGroup.disabled = sender.isOn + self?.smallButtonGroup.disabled = sender.isOn + } widthTextField .textPublisher diff --git a/VDSSample/ViewControllers/ButtonViewController.swift b/VDSSample/ViewControllers/ButtonViewController.swift index 2844b06..aacd340 100644 --- a/VDSSample/ViewControllers/ButtonViewController.swift +++ b/VDSSample/ViewControllers/ButtonViewController.swift @@ -51,13 +51,11 @@ class ButtonViewController: BaseViewController { addFormRow(label: "Text", view: textField) addFormRow(label: "Width", view: widthTextField) addFormRow(label: "Size", view: buttonSizePickerSelectorView) - - - disabledSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.button.disabled = sender.isOn - }.store(in: &subscribers) + + + disabledSwitch.onChange = { [weak self] sender in + self?.button.disabled = sender.isOn + } textField .textPublisher diff --git a/VDSSample/ViewControllers/CheckBoxGroupViewController.swift b/VDSSample/ViewControllers/CheckBoxGroupViewController.swift index 10314e5..d5bd556 100644 --- a/VDSSample/ViewControllers/CheckBoxGroupViewController.swift +++ b/VDSSample/ViewControllers/CheckBoxGroupViewController.swift @@ -37,18 +37,14 @@ class CheckboxGroupViewController: BaseViewController { addFormRow(label: "Label Text", view: labelTextField) addFormRow(label: "Child Text", view: childTextField) addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch)) - - showErrorSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.checkboxGroup.showError = sender.isOn - }.store(in: &subscribers) - - disabledSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.checkboxGroup.disabled = sender.isOn - }.store(in: &subscribers) + + showErrorSwitch.onChange = { [weak self] sender in + self?.checkboxGroup.showError = sender.isOn + } + + disabledSwitch.onChange = { [weak self] sender in + self?.checkboxGroup.disabled = sender.isOn + } labelTextField .textPublisher @@ -77,20 +73,18 @@ class CheckboxGroupViewController: BaseViewController { checkbox2.childText = "Apple iPhone 11 - 128 GB\nOtterbox Case Black\nScreen Protector" checkboxGroup.selectorViews = [checkbox1, checkbox2] - - checkboxGroup - .publisher(for: .valueChanged) - .sink { [weak self] group in - let selected = group.selectedHandlers? - .compactMap{"\($0.labelText!)"} - .joined(separator: "\r") ?? "none 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) + + checkboxGroup.onChange = { [weak self] group in + let selected = group.selectedHandlers? + .compactMap{"\($0.labelText!)"} + .joined(separator: "\r") ?? "none 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) + } //setup UI surfacePickerSelectorView.text = checkboxGroup.surface.rawValue diff --git a/VDSSample/ViewControllers/CheckboxViewController.swift b/VDSSample/ViewControllers/CheckboxViewController.swift index 3325694..953e2e8 100644 --- a/VDSSample/ViewControllers/CheckboxViewController.swift +++ b/VDSSample/ViewControllers/CheckboxViewController.swift @@ -39,22 +39,18 @@ class CheckboxViewController: BaseViewController { addFormRow(label: "Child Text", view: childTextField) addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch)) addFormRow(label: "Error Text", view: errorTextField) - - showErrorSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - guard let self else { return } - self.checkbox.showError = sender.isOn - if self.checkbox.showError != sender.isOn { - self.showErrorSwitch.isOn = self.checkbox.showError - } - }.store(in: &subscribers) - - disabledSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.checkbox.disabled = sender.isOn - }.store(in: &subscribers) + + showErrorSwitch.onChange = { [weak self] sender in + guard let self else { return } + self.checkbox.showError = sender.isOn + if self.checkbox.showError != sender.isOn { + self.showErrorSwitch.isOn = self.checkbox.showError + } + } + + disabledSwitch.onChange = { [weak self] sender in + self?.checkbox.disabled = sender.isOn + } labelTextField .textPublisher @@ -80,17 +76,15 @@ class CheckboxViewController: BaseViewController { checkbox.childText = "I agree to Verizon's terms and conditions click here" checkbox.errorText = "Error Text" - checkbox - .publisher(for: .valueChanged) - .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) - self?.showErrorSwitch.isOn = checkbox.showError - print("checkbox selected: \(checkbox.isSelected)") - }.store(in: &subscribers) + checkbox.onChange = { [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) + self?.showErrorSwitch.isOn = checkbox.showError + print("checkbox selected: \(checkbox.isSelected)") + } //setup UI surfacePickerSelectorView.text = checkbox.surface.rawValue diff --git a/VDSSample/ViewControllers/InputFieldViewController.swift b/VDSSample/ViewControllers/InputFieldViewController.swift index 28197ee..e8750ab 100644 --- a/VDSSample/ViewControllers/InputFieldViewController.swift +++ b/VDSSample/ViewControllers/InputFieldViewController.swift @@ -57,38 +57,30 @@ class InputFieldViewController: BaseViewController { addFormRow(label: "Width", view: widthTextField) addFormRow(label: "ToolTip Title", view: tooltipTitleTextField) addFormRow(label: "ToolTip Content", view: tooltipContentTextField) - - requiredSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.textEntryField.required = sender.isOn - }.store(in: &subscribers) - - showErrorSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - guard let self else { return } - self.textEntryField.showError = sender.isOn - if self.textEntryField.showError != sender.isOn { - self.showErrorSwitch.isOn = self.textEntryField.showError - } - }.store(in: &subscribers) - showSuccessSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - guard let self else { return } - self.textEntryField.showSuccess = sender.isOn - if self.textEntryField.showSuccess != sender.isOn { - self.showSuccessSwitch.isOn = self.textEntryField.showSuccess - } - }.store(in: &subscribers) + requiredSwitch.onChange = { [weak self] sender in + self?.textEntryField.required = sender.isOn + } - disabledSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.textEntryField.disabled = sender.isOn - }.store(in: &subscribers) + showErrorSwitch.onChange = { [weak self] sender in + guard let self else { return } + self.textEntryField.showError = sender.isOn + if self.textEntryField.showError != sender.isOn { + self.showErrorSwitch.isOn = self.textEntryField.showError + } + } + + showSuccessSwitch.onChange = { [weak self] sender in + guard let self else { return } + self.textEntryField.showSuccess = sender.isOn + if self.textEntryField.showSuccess != sender.isOn { + self.showSuccessSwitch.isOn = self.textEntryField.showSuccess + } + } + + disabledSwitch.onChange = { [weak self] sender in + self?.textEntryField.disabled = sender.isOn + } labelTextField .textPublisher diff --git a/VDSSample/ViewControllers/LabelViewController.swift b/VDSSample/ViewControllers/LabelViewController.swift index d573c78..087a53a 100644 --- a/VDSSample/ViewControllers/LabelViewController.swift +++ b/VDSSample/ViewControllers/LabelViewController.swift @@ -47,12 +47,10 @@ class LabelViewController: BaseViewController { addFormRow(label: "Font Category", view: fontCategoryPickerSelectorView) addFormRow(label: "Text Size", view: textSizePickerSelectorView) addFormRow(label: "Text", view: textField) - - disabledSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.label.disabled = sender.isOn - }.store(in: &subscribers) + + disabledSwitch.onChange = { [weak self] sender in + self?.label.disabled = sender.isOn + } boldSwitch .publisher(for: .valueChanged) diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift index 330321e..aaa204c 100644 --- a/VDSSample/ViewControllers/NotificationViewController.swift +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -69,7 +69,7 @@ class NotificationViewController: BaseViewController { self.notificationView.subTitleText = newString }.store(in: &subscribers) - buttonGroupToggle.publisher(for: .valueChanged).sink { [weak self] toggle in + buttonGroupToggle.onChange = { [weak self] toggle in if toggle.isOn { self?.notificationView.primaryButtonModel = nil self?.notificationView.secondaryButtonModel = nil @@ -77,8 +77,7 @@ class NotificationViewController: BaseViewController { } else { self?.setupButtons(with: self?.firstButtonDefaultText, secondButtonText: self?.secondButtonDefaultText) } - }.store(in: &subscribers) - + } firstButtonTextField.textPublisher.sink { newString in diff --git a/VDSSample/ViewControllers/RadioBoxGroupViewController.swift b/VDSSample/ViewControllers/RadioBoxGroupViewController.swift index d24917a..2af776e 100644 --- a/VDSSample/ViewControllers/RadioBoxGroupViewController.swift +++ b/VDSSample/ViewControllers/RadioBoxGroupViewController.swift @@ -41,17 +41,13 @@ class RadioBoxGroupViewController: BaseViewController { addFormRow(label: "Sub Text", view: subTextField) addFormRow(label: "Sub Text Right", view: subTextRightField) - disabledSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.radioBoxGroup.disabled = sender.isOn - }.store(in: &subscribers) + disabledSwitch.onChange = { [weak self] sender in + self?.radioBoxGroup.disabled = sender.isOn + } - strikeThroughSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.radioBox?.strikethrough = sender.isOn - }.store(in: &subscribers) + strikeThroughSwitch.onChange = { [weak self] sender in + self?.radioBox?.strikethrough = sender.isOn + } textField .textPublisher diff --git a/VDSSample/ViewControllers/RadioButtonViewController.swift b/VDSSample/ViewControllers/RadioButtonViewController.swift index 9b09730..ec87dcc 100644 --- a/VDSSample/ViewControllers/RadioButtonViewController.swift +++ b/VDSSample/ViewControllers/RadioButtonViewController.swift @@ -38,17 +38,13 @@ class RadioButtonViewController: BaseViewController { addFormRow(label: "Child Text", view: childTextField) addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch)) - showErrorSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.radioButtonGroup.showError = sender.isOn - }.store(in: &subscribers) + showErrorSwitch.onChange = { [weak self] sender in + self?.radioButtonGroup.showError = sender.isOn + } - disabledSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.radioButtonGroup.disabled = sender.isOn - }.store(in: &subscribers) + disabledSwitch.onChange = { [weak self] sender in + self?.radioButtonGroup.disabled = sender.isOn + } labelTextField .textPublisher @@ -84,18 +80,16 @@ class RadioButtonViewController: BaseViewController { radioButton3.childText = "Apple iPhone 11 - 256 GB\nOtterbox Case Black\nScreen Protector" radioButtonGroup.selectorViews = [radioButton1, radioButton2, radioButton3] - - radioButtonGroup - .publisher(for: .valueChanged) - .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) + + radioButtonGroup.onChange = { [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")") + } //set UI values surfacePickerSelectorView.text = radioButtonGroup.surface.rawValue diff --git a/VDSSample/ViewControllers/RadioSwatchGroupViewController.swift b/VDSSample/ViewControllers/RadioSwatchGroupViewController.swift index dcf1d4c..5d969d1 100644 --- a/VDSSample/ViewControllers/RadioSwatchGroupViewController.swift +++ b/VDSSample/ViewControllers/RadioSwatchGroupViewController.swift @@ -29,19 +29,15 @@ class RadioSwatchGroupViewController: BaseViewController { addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch)) addFormRow(label: "Surface", view: surfacePickerSelectorView) addFormRow(label: "Strikethrough", view: .makeWrapper(for: strikeThroughSwitch)) - - disabledSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.radioSwatchGroup.disabled = sender.isOn - }.store(in: &subscribers) - - strikeThroughSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.radioSwatchGroup.selectorViews.first?.strikethrough = sender.isOn - self?.radioSwatchGroup.reload() - }.store(in: &subscribers) + + disabledSwitch.onChange = { [weak self] sender in + self?.radioSwatchGroup.disabled = sender.isOn + } + + strikeThroughSwitch.onChange = { [weak self] sender in + self?.radioSwatchGroup.selectorViews.first?.strikethrough = sender.isOn + self?.radioSwatchGroup.reload() + } } func setupModel(){ @@ -88,12 +84,10 @@ class RadioSwatchGroupViewController: BaseViewController { radioSwatch8.inputId = "radioSwatch8" radioSwatchGroup.selectorViews = [radioSwatch1, radioSwatch2, radioSwatch3, radioSwatch4, radioSwatch5, radioSwatch6, radioSwatch7, radioSwatch8] - - radioSwatchGroup - .publisher(for: .valueChanged) - .sink { group in - print("Selected: \(group.selectedHandler?.text ?? "none")") - }.store(in: &subscribers) + + radioSwatchGroup.onChange = { group in + print("Selected: \(group.selectedHandler?.text ?? "none")") + } //set UI values surfacePickerSelectorView.text = radioSwatchGroup.surface.rawValue diff --git a/VDSSample/ViewControllers/TextAreaViewController.swift b/VDSSample/ViewControllers/TextAreaViewController.swift index ce59263..70607b6 100644 --- a/VDSSample/ViewControllers/TextAreaViewController.swift +++ b/VDSSample/ViewControllers/TextAreaViewController.swift @@ -47,28 +47,22 @@ class TextAreaViewController: BaseViewController { addFormRow(label: "Width", view: widthTextField) addFormRow(label: "ToolTip Title", view: tooltipTitleTextField) addFormRow(label: "ToolTip Content", view: tooltipContentTextField) - - requiredSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.textArea.required = sender.isOn - }.store(in: &subscribers) - - showErrorSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - guard let self else { return } - self.textArea.showError = sender.isOn - if self.textArea.showError != sender.isOn { - self.showErrorSwitch.isOn = self.textArea.showError - } - }.store(in: &subscribers) - disabledSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.textArea.disabled = sender.isOn - }.store(in: &subscribers) + requiredSwitch.onChange = { [weak self] sender in + self?.textArea.required = sender.isOn + } + + showErrorSwitch.onChange = { [weak self] sender in + guard let self else { return } + self.textArea.showError = sender.isOn + if self.textArea.showError != sender.isOn { + self.showErrorSwitch.isOn = self.textArea.showError + } + } + + disabledSwitch.onChange = { [weak self] sender in + self?.textArea.disabled = sender.isOn + } labelTextField .textPublisher diff --git a/VDSSample/ViewControllers/TextLinkCaretViewController.swift b/VDSSample/ViewControllers/TextLinkCaretViewController.swift index 389d0da..af0f40c 100644 --- a/VDSSample/ViewControllers/TextLinkCaretViewController.swift +++ b/VDSSample/ViewControllers/TextLinkCaretViewController.swift @@ -42,12 +42,10 @@ class TextLinkCaretViewController: BaseViewController { addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch)) addFormRow(label: "Label", view: textField) addFormRow(label: "Caret Position", view: caretPositionPickerSelectorView) - - disabledSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.textLinkCaret.disabled = sender.isOn - }.store(in: &subscribers) + + disabledSwitch.onChange = { [weak self] sender in + self?.textLinkCaret.disabled = sender.isOn + } textField .textPublisher diff --git a/VDSSample/ViewControllers/TextLinkViewController.swift b/VDSSample/ViewControllers/TextLinkViewController.swift index ff37f85..197b5a3 100644 --- a/VDSSample/ViewControllers/TextLinkViewController.swift +++ b/VDSSample/ViewControllers/TextLinkViewController.swift @@ -43,13 +43,11 @@ class TextLinkViewController: BaseViewController { addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch)) addFormRow(label: "Label", view: textField) addFormRow(label: "Size", view: buttonSizePickerSelectorView) - - disabledSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.textLink.disabled = sender.isOn - }.store(in: &subscribers) - + + disabledSwitch.onChange = { [weak self] sender in + self?.textLink.disabled = sender.isOn + } + textField .textPublisher .sink { [weak self] text in diff --git a/VDSSample/ViewControllers/TileContainerViewController.swift b/VDSSample/ViewControllers/TileContainerViewController.swift index d9d72fd..10b5e0c 100644 --- a/VDSSample/ViewControllers/TileContainerViewController.swift +++ b/VDSSample/ViewControllers/TileContainerViewController.swift @@ -73,41 +73,33 @@ class TileContainerViewController: BaseViewController { addFormRow(label: "Aspect Ratio", view: scalingTypePickerSelectorView) addFormRow(label: "Background Image", view: .makeWrapper(for: showBackgroundImageSwitch)) addFormRow(label: "Image Fallback Color", view: imageFallbackColorPickerSelectorView) - - clickableSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - guard let self else { return } - if sender.isOn { - self.tileContainer.onClick = { _ in - print("you click on me!") - } - } else { - self.tileContainer.onClick = nil + + clickableSwitch.onChange = { [weak self] sender in + guard let self else { return } + if sender.isOn { + self.tileContainer.onClick = { _ in + print("you click on me!") } - }.store(in: &subscribers) + } else { + self.tileContainer.onClick = nil + } + } + + showBackgroundImageSwitch.onChange = { [weak self] sender in + if let image = self?.backgroundImage, sender.isOn { + self?.tileContainer.backgroundImage = image + } else { + self?.tileContainer.backgroundImage = nil + } + } - showBackgroundImageSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - if let image = self?.backgroundImage, sender.isOn { - self?.tileContainer.backgroundImage = image - } else { - self?.tileContainer.backgroundImage = nil - } - }.store(in: &subscribers) - - showBorderSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in + showBorderSwitch.onChange = { [weak self] sender in self?.tileContainer.showBorder = sender.isOn - }.store(in: &subscribers) - - showDropShadowSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.tileContainer.showDropShadows = sender.isOn - }.store(in: &subscribers) + } + + showDropShadowSwitch.onChange = { [weak self] sender in + self?.tileContainer.showDropShadows = sender.isOn + } heightTextField .textPublisher diff --git a/VDSSample/ViewControllers/TileletViewController.swift b/VDSSample/ViewControllers/TileletViewController.swift index d3e5ed5..b8dad5a 100644 --- a/VDSSample/ViewControllers/TileletViewController.swift +++ b/VDSSample/ViewControllers/TileletViewController.swift @@ -27,19 +27,19 @@ class TileletViewController: BaseViewController { lazy var subtitleColorPickerSelectorView = { PickerSelectorView(title: "", - picker: self.picker, - items: [.primary, .secondary]) + picker: self.picker, + items: [.primary, .secondary]) }() - + var clickableSwitch = Toggle() - + var titleTextField = TextField() var subTitleTextField = TextField() var widthTextField = NumericField() var heightTextField = NumericField() var textPercentageTextField = NumericField() var textWidthTextField = NumericField() - + var showDescriptionIconSwitch = Toggle() var showDirectionalIconSwitch = Toggle() var badgeTextField = TextField() @@ -55,11 +55,11 @@ class TileletViewController: BaseViewController { } override func allTextFields() -> [TextField]? { [titleTextField, subTitleTextField, widthTextField, heightTextField, textWidthTextField, textPercentageTextField, badgeTextField] } - + func setupForm(){ addFormRow(label: "Surface", view: surfacePickerSelectorView) addFormRow(label: "Clickable", view: .makeWrapper(for: clickableSwitch)) - + addFormRow(label: "Title Style", view: titleTextStylePickerSelectorView) addFormRow(label: "Other Style", view: otherTextStylePickerSelectorView) @@ -74,18 +74,17 @@ class TileletViewController: BaseViewController { addFormRow(label: "Description Icon", view: .makeWrapper(for: showDescriptionIconSwitch)) addFormRow(label: "Directional Icon", view: .makeWrapper(for: showDirectionalIconSwitch)) - clickableSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - guard let tilelet = self?.tilelet else { return } - if sender.isOn { - tilelet.onClick = { t in - print("you click on me!") - } - } else { - tilelet.onClick = nil + clickableSwitch.onChange = { [weak self] sender in + guard let tilelet = self?.tilelet else { return } + if sender.isOn { + tilelet.onClick = { t in + print("you click on me!") } - }.store(in: &subscribers) + } else { + tilelet.onClick = nil + } + } + widthTextField .textPublisher .sink { [weak self] text in @@ -93,7 +92,7 @@ class TileletViewController: BaseViewController { self?.tilelet.width = CGFloat(truncating: n) } }.store(in: &subscribers) - + heightTextField .textPublisher .sink { [weak self] text in @@ -103,7 +102,7 @@ class TileletViewController: BaseViewController { self?.tilelet.height = nil } }.store(in: &subscribers) - + textWidthTextField .textPublisher .sink { [weak self] text in @@ -126,49 +125,45 @@ class TileletViewController: BaseViewController { self?.tilelet.textPercentage = nil } }.store(in: &subscribers) - + titleTextField .textPublisher .sink { [weak self] text in self?.setTitleModel() }.store(in: &subscribers) - + subTitleTextField .textPublisher .sink { [weak self] text in self?.setSubTitleModel() }.store(in: &subscribers) - + badgeTextField .textPublisher .sink { [weak self] text in self?.setBadgeModel() }.store(in: &subscribers) - showDescriptionIconSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - if sender.isOn { - self?.showDirectionalIconSwitch.isOn = false - self?.tilelet.descriptiveIconModel = .init(size: .medium, surface: .dark) - } else { - self?.tilelet.descriptiveIconModel = nil - } - }.store(in: &subscribers) - - showDirectionalIconSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - if sender.isOn { - self?.showDescriptionIconSwitch.isOn = false - self?.tilelet.directionalIconModel = .init(size: .medium, surface: .dark) - } else { - self?.tilelet.directionalIconModel = nil - } - }.store(in: &subscribers) - - } + showDescriptionIconSwitch.onChange = { [weak self] sender in + if sender.isOn { + self?.showDirectionalIconSwitch.isOn = false + self?.tilelet.descriptiveIconModel = .init(size: .medium, surface: .dark) + } else { + self?.tilelet.descriptiveIconModel = nil + } + } + showDirectionalIconSwitch.onChange = { [weak self] sender in + if sender.isOn { + self?.showDescriptionIconSwitch.isOn = false + self?.tilelet.directionalIconModel = .init(size: .medium, surface: .dark) + } else { + self?.tilelet.directionalIconModel = nil + } + } + + } + func setupModel() { let titleModel = Tilelet.TitleModel(text: "Save $XX on your monthly bill.") let subTitleModel = Tilelet.SubTitleModel(text: "Enroll in Auto Pay & paper-free billing to save on your monthly bill.") @@ -176,7 +171,7 @@ class TileletViewController: BaseViewController { tilelet.surface = .light tilelet.titleModel = titleModel tilelet.subTitleModel = subTitleModel - + //setup UI surfacePickerSelectorView.text = tilelet.surface.rawValue otherTextStylePickerSelectorView.text = subTitleModel.textStyle.rawValue @@ -211,7 +206,7 @@ class TileletViewController: BaseViewController { tilelet.subTitleModel = nil } } - + //Picker func setupPicker(){ surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in @@ -222,7 +217,7 @@ class TileletViewController: BaseViewController { titleTextStylePickerSelectorView.onPickerDidSelect = { [weak self] item in self?.setTitleModel() } - + otherTextStylePickerSelectorView.onPickerDidSelect = { [weak self] item in self?.setSubTitleModel() } diff --git a/VDSSample/ViewControllers/ToggleViewController.swift b/VDSSample/ViewControllers/ToggleViewController.swift index 9fbab2d..c877c25 100644 --- a/VDSSample/ViewControllers/ToggleViewController.swift +++ b/VDSSample/ViewControllers/ToggleViewController.swift @@ -69,34 +69,27 @@ class ToggleViewController: BaseViewController { //add textFormStackView to main form formStackView.addArrangedSubview(textFormStackView) - 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) + toggle.onChange = { [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)") + } - showTextSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.toggle.showText = sender.isOn - self?.textFormStackView.isHidden = !sender.isOn - }.store(in: &subscribers) - - disabledSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.toggle.disabled = sender.isOn - }.store(in: &subscribers) + showTextSwitch.onChange = { [weak self] sender in + self?.toggle.showText = sender.isOn + self?.textFormStackView.isHidden = !sender.isOn + } - boldSwitch - .publisher(for: .valueChanged) - .sink { [weak self] sender in - self?.toggle.textWeight = sender.isOn ? .bold : .regular - }.store(in: &subscribers) + disabledSwitch.onChange = { [weak self] sender in + self?.toggle.disabled = sender.isOn + } + + boldSwitch.onChange = { [weak self] sender in + self?.toggle.textWeight = sender.isOn ? .bold : .regular + } onTextField .textPublisher From e8c92a0a05876ee0ec253176c107d1465b2df378 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Tue, 4 Apr 2023 16:29:51 +0530 Subject: [PATCH 08/10] Notification controller, adding fullBleed toggle --- .../NotificationViewController.swift | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift index 3c4b5fa..82f1942 100644 --- a/VDSSample/ViewControllers/NotificationViewController.swift +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -18,6 +18,7 @@ class NotificationViewController: BaseViewController { let firstButtonTextField = TextField() let secondButtonTextField = TextField() let hideCloseButtonToggle = Toggle() + let fullBleedToggle = Toggle() let titleDefaultText = "This is title" let subtitleDefaultText = "This is subtitle" @@ -36,6 +37,7 @@ class NotificationViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + addContentTopView(view: notificationView) notificationView.title = titleDefaultText notificationView.subTitle = subtitleDefaultText @@ -46,20 +48,19 @@ class NotificationViewController: BaseViewController { firstButtonTextField.text = firstButtonDefaultText secondButtonTextField.text = secondButtonDefaultText - addContentTopView(view: notificationView) - setupForm() setupPicker() } func setupForm() { addFormRow(label: "Surface", view: surfacePickerSelectorView) - addFormRow(label: "Style", view: notificationTypePickerSelectorView) + addFormRow(label: "Type", view: notificationTypePickerSelectorView) addFormRow(label: "Layout", view: layoutTypePickerSelectorView) addFormRow(label: "Title", view: titleTextField) addFormRow(label: "SubTitle", view: subTitleTextField) addFormRow(label: "Hide Button Group", view: buttonGroupToggle) addFormRow(label: "Hide Close Button", view: hideCloseButtonToggle) + addFormRow(label: "Full bleed", view: fullBleedToggle) addFormRow(label: "Button Action", view: label) addFormRow(label: "First Button Text", view: firstButtonTextField) addFormRow(label: "Second Button Text", view: secondButtonTextField) @@ -106,6 +107,17 @@ class NotificationViewController: BaseViewController { hideCloseButtonToggle.publisher(for: .valueChanged).sink(receiveValue: { [weak self] toggle in self?.notificationView.hideCloseButton = toggle.isOn }).store(in: &subscribers) + + fullBleedToggle.publisher(for: .valueChanged).sink(receiveValue: { [weak self] toggle in + self?.notificationView.fullBleed = toggle.isOn + + let isFullBleed = self?.notificationView.fullBleed ?? false + + self?.notificationView.leadingConstraint?.constant = isFullBleed ? 0 : 16 + self?.notificationView.trailingConstraint?.constant = isFullBleed ? 0 : 16 + self?.notificationView.leadingConstraint?.isActive = isFullBleed + self?.notificationView.trailingConstraint?.isActive = isFullBleed + }).store(in: &subscribers) } func setupPicker() { From 4f20e6f24521b9de69420016f8c485fe13418a2c Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Tue, 4 Apr 2023 16:33:06 +0530 Subject: [PATCH 09/10] Updating Notification completion status. --- VDSSample/ViewControllers/MenuViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VDSSample/ViewControllers/MenuViewController.swift b/VDSSample/ViewControllers/MenuViewController.swift index 0777d93..9e6ddb6 100644 --- a/VDSSample/ViewControllers/MenuViewController.swift +++ b/VDSSample/ViewControllers/MenuViewController.swift @@ -80,7 +80,7 @@ class MenuViewController: UITableViewController { MenuComponent(title: "InputField", completed: false, viewController: InputFieldViewController.self), MenuComponent(title: "Label", completed: true, viewController: LabelViewController.self), MenuComponent(title: "Line", completed: true, viewController: LineViewController.self), - MenuComponent(title: "Notification", completed: false, viewController: NotificationViewController.self), + MenuComponent(title: "Notification", completed: true, viewController: NotificationViewController.self), MenuComponent(title: "RadioBoxGroup", completed: true, viewController: RadioBoxGroupViewController.self), MenuComponent(title: "RadioButtonGroup", completed: true, viewController: RadioButtonViewController.self), MenuComponent(title: "RadioSwatchGroup", completed: true, viewController: RadioSwatchGroupViewController.self), From 3b75e3dc5a27c648d7bcc1a4513419e38064be8f Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 4 Apr 2023 12:03:31 -0500 Subject: [PATCH 10/10] updated Signed-off-by: Matt Bruce --- .../NotificationViewController.swift | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift index 82f1942..03fb2ea 100644 --- a/VDSSample/ViewControllers/NotificationViewController.swift +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -104,20 +104,13 @@ class NotificationViewController: BaseViewController { } }.store(in: &subscribers) - hideCloseButtonToggle.publisher(for: .valueChanged).sink(receiveValue: { [weak self] toggle in + hideCloseButtonToggle.onChange = { [weak self] toggle in self?.notificationView.hideCloseButton = toggle.isOn - }).store(in: &subscribers) + } - fullBleedToggle.publisher(for: .valueChanged).sink(receiveValue: { [weak self] toggle in + fullBleedToggle.onChange = { [weak self] toggle in self?.notificationView.fullBleed = toggle.isOn - - let isFullBleed = self?.notificationView.fullBleed ?? false - - self?.notificationView.leadingConstraint?.constant = isFullBleed ? 0 : 16 - self?.notificationView.trailingConstraint?.constant = isFullBleed ? 0 : 16 - self?.notificationView.leadingConstraint?.isActive = isFullBleed - self?.notificationView.trailingConstraint?.isActive = isFullBleed - }).store(in: &subscribers) + } } func setupPicker() {