From 68f5da116df2262e66c5adfa3338d255504eb03b Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Wed, 15 Mar 2023 23:06:15 +0530 Subject: [PATCH 1/8] Setting up notification class to test --- VDSSample.xcodeproj/project.pbxproj | 4 ++ .../ViewControllers/MenuViewController.swift | 3 +- .../NotificationViewController.swift | 58 +++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 VDSSample/ViewControllers/NotificationViewController.swift diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index a63c81b..3102bd5 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -32,6 +32,7 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 445BA07A29C088470036A7C5 /* NotificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 445BA07929C088470036A7C5 /* NotificationViewController.swift */; }; 5FC35BE928D5235A004EBEAC /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */; }; EA0FC2C12912DC5500DF80B4 /* TextLinkCaretViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */; }; EA3C3B9D289966EF000CA526 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3B9C289966EF000CA526 /* AppDelegate.swift */; }; @@ -113,6 +114,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 445BA07929C088470036A7C5 /* NotificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewController.swift; sourceTree = ""; }; 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = ""; }; EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextLinkCaretViewController.swift; sourceTree = ""; }; EA3C3B99289966EF000CA526 /* VDSSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VDSSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -297,6 +299,7 @@ EA5E305B295111050082B959 /* TileletViewController.swift */, EA5E30542950EA6E0082B959 /* TitleLockupViewController.swift */, EA3C3BB328996775000CA526 /* ToggleViewController.swift */, + 445BA07929C088470036A7C5 /* NotificationViewController.swift */, ); path = ViewControllers; sourceTree = ""; @@ -452,6 +455,7 @@ EA3C3BB628996775000CA526 /* MenuViewController.swift in Sources */, EA3C3B9D289966EF000CA526 /* AppDelegate.swift in Sources */, EA5E3050294D11540082B959 /* TileContainerViewController.swift in Sources */, + 445BA07A29C088470036A7C5 /* NotificationViewController.swift in Sources */, EAF7F11A28A14A0E00B287F5 /* RadioButtonViewController.swift in Sources */, EA89204628B66CE2006B9984 /* ScrollViewController.swift in Sources */, EA3C3B9F289966EF000CA526 /* SceneDelegate.swift in Sources */, diff --git a/VDSSample/ViewControllers/MenuViewController.swift b/VDSSample/ViewControllers/MenuViewController.swift index 8fdf1e0..f3daed8 100644 --- a/VDSSample/ViewControllers/MenuViewController.swift +++ b/VDSSample/ViewControllers/MenuViewController.swift @@ -88,7 +88,8 @@ class MenuViewController: UITableViewController { MenuComponent(title: "TileContainer", completed: true, viewController: TileContainerViewController.self), MenuComponent(title: "Tilelet", completed: false, viewController: TileletViewController.self), MenuComponent(title: "TitleLockup", completed: true, viewController: TitleLockupViewController.self), - MenuComponent(title: "Toggle", completed: true, viewController: ToggleViewController.self) + MenuComponent(title: "Toggle", completed: true, viewController: ToggleViewController.self), + MenuComponent(title: "Notification", completed: false, viewController: NotificationViewController.self) ] override func numberOfSections(in tableView: UITableView) -> Int { diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift new file mode 100644 index 0000000..550d7b4 --- /dev/null +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -0,0 +1,58 @@ +// +// NotificationViewController.swift +// VDSSample +// +// Created by Nadigadda, Sumanth on 14/03/23. +// + +import Foundation +import VDS + +class NotificationViewController: BaseViewController { + + var notificationView = Notification() + + lazy var notificationTypePickerSelectorView = { + PickerSelectorView(title: "Info", + picker: self.picker, + items: Notification.NotificationStyle.allCases) + }() + + override func viewDidLoad() { + super.viewDidLoad() + + notificationView.titleLabel.text = "Good morning" + notificationView.subTitleLabel.text = "SecondLabel information" + + let firstButton = Button() + firstButton.use = .secondary + firstButton.size = .small + + let secondButton = Button() + secondButton.use = .primary + secondButton.size = .small + + notificationView.buttonsView.buttons = [firstButton,secondButton] + addContentTopView(view: notificationView) + + setupForm() + setupPicker() + } + + func setupForm() { + addFormRow(label: "Surface", view: surfacePickerSelectorView) + addFormRow(label: "Style", view: notificationTypePickerSelectorView) + } + + func setupPicker() { + surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.notificationView.surface = item + self?.contentTopView.backgroundColor = item.color + } + + notificationTypePickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.notificationView.type = item + } + + } +} From 090afa2f01fd34a8150c658cd40600165173aea6 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 17 Mar 2023 15:55:59 -0500 Subject: [PATCH 2/8] updated notification Signed-off-by: Matt Bruce --- VDSSample.xcodeproj/project.pbxproj | 2 +- VDSSample/Classes/Helper.swift | 4 ++-- .../ViewControllers/MenuViewController.swift | 4 ++-- .../NotificationViewController.swift | 20 ++++++++----------- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index 3102bd5..3728a4c 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -290,6 +290,7 @@ EAA5EEAC28EB6924003B3210 /* InputFieldViewController.swift */, EAC9257F29119FC400091998 /* TextLinkViewController.swift */, EAB1D2D328AC409F00DAE764 /* LabelViewController.swift */, + 445BA07929C088470036A7C5 /* NotificationViewController.swift */, EA89201828B56DF5006B9984 /* RadioBoxGroupViewController.swift */, EAF7F11928A14A0E00B287F5 /* RadioButtonViewController.swift */, EA84F76128BE4AE500D67ABC /* RadioSwatchGroupViewController.swift */, @@ -299,7 +300,6 @@ EA5E305B295111050082B959 /* TileletViewController.swift */, EA5E30542950EA6E0082B959 /* TitleLockupViewController.swift */, EA3C3BB328996775000CA526 /* ToggleViewController.swift */, - 445BA07929C088470036A7C5 /* NotificationViewController.swift */, ); path = ViewControllers; sourceTree = ""; diff --git a/VDSSample/Classes/Helper.swift b/VDSSample/Classes/Helper.swift index 8a140f9..ae446bd 100644 --- a/VDSSample/Classes/Helper.swift +++ b/VDSSample/Classes/Helper.swift @@ -26,7 +26,7 @@ extension UIView { extension ButtonBase { func labelPublisher(_ label: UILabel){ - publisher(for: .touchUpInside) + onClickSubscriber = publisher(for: .touchUpInside) .sink { control in let newText = "\(control.text!) clicked - " if let labelText = label.text { @@ -38,7 +38,7 @@ extension ButtonBase { label.text = "\(newText)1" } print("clicked me") - }.store(in: &subscribers) + } } } diff --git a/VDSSample/ViewControllers/MenuViewController.swift b/VDSSample/ViewControllers/MenuViewController.swift index f3daed8..80c7169 100644 --- a/VDSSample/ViewControllers/MenuViewController.swift +++ b/VDSSample/ViewControllers/MenuViewController.swift @@ -79,6 +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: "Notification", completed: false, 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), @@ -88,8 +89,7 @@ class MenuViewController: UITableViewController { MenuComponent(title: "TileContainer", completed: true, viewController: TileContainerViewController.self), MenuComponent(title: "Tilelet", completed: false, viewController: TileletViewController.self), MenuComponent(title: "TitleLockup", completed: true, viewController: TitleLockupViewController.self), - MenuComponent(title: "Toggle", completed: true, viewController: ToggleViewController.self), - MenuComponent(title: "Notification", completed: false, viewController: NotificationViewController.self) + MenuComponent(title: "Toggle", completed: true, viewController: ToggleViewController.self) ] override func numberOfSections(in tableView: UITableView) -> Int { diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift index 550d7b4..3103e66 100644 --- a/VDSSample/ViewControllers/NotificationViewController.swift +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -21,18 +21,14 @@ class NotificationViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() - notificationView.titleLabel.text = "Good morning" - notificationView.subTitleLabel.text = "SecondLabel information" - - let firstButton = Button() - firstButton.use = .secondary - firstButton.size = .small - - let secondButton = Button() - secondButton.use = .primary - secondButton.size = .small - - notificationView.buttonsView.buttons = [firstButton,secondButton] + notificationView.titleText = "Good morning" + notificationView.subTitleText = "SecondLabel information" + notificationView.primaryButtonModel = .init(text: "First", onClick: { button in + print("\(button.text!) button click") + }) + notificationView.secondaryButtonModel = .init(text: "Second", onClick: { button in + print("\(button.text!) button click") + }) addContentTopView(view: notificationView) setupForm() From 48b655bc5c1d8f805b07fcb8221c92c3640aa329 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Mon, 20 Mar 2023 12:24:00 +0530 Subject: [PATCH 3/8] Adding customizing fields in Notification controller. --- .../NotificationViewController.swift | 81 +++++++++++++++++-- 1 file changed, 73 insertions(+), 8 deletions(-) diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift index 3103e66..0856eed 100644 --- a/VDSSample/ViewControllers/NotificationViewController.swift +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -11,6 +11,16 @@ import VDS class NotificationViewController: BaseViewController { var notificationView = Notification() + let titleTextField = TextField() + let subTitleTextField = TextField() + let buttonGroupToggle = Toggle() + let firstButtonTextField = TextField() + let secondButtonTextField = TextField() + + let titleDefaultText = "This is title" + let subtitleDefaultText = "This is subtitle" + let firstButtonDefaultText = "Button 1" + let secondButtonDefaultText = "Button 2" lazy var notificationTypePickerSelectorView = { PickerSelectorView(title: "Info", @@ -21,14 +31,15 @@ class NotificationViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() - notificationView.titleText = "Good morning" - notificationView.subTitleText = "SecondLabel information" - notificationView.primaryButtonModel = .init(text: "First", onClick: { button in - print("\(button.text!) button click") - }) - notificationView.secondaryButtonModel = .init(text: "Second", onClick: { button in - print("\(button.text!) button click") - }) + notificationView.titleText = titleDefaultText + notificationView.subTitleText = subtitleDefaultText + titleTextField.text = titleDefaultText + subTitleTextField.text = subtitleDefaultText + + setupButtons(with: firstButtonDefaultText, secondButtonText: secondButtonDefaultText) + firstButtonTextField.text = firstButtonDefaultText + secondButtonTextField.text = secondButtonDefaultText + addContentTopView(view: notificationView) setupForm() @@ -38,6 +49,46 @@ class NotificationViewController: BaseViewController { func setupForm() { addFormRow(label: "Surface", view: surfacePickerSelectorView) addFormRow(label: "Style", view: notificationTypePickerSelectorView) + addFormRow(label: "Title", view: titleTextField) + addFormRow(label: "SubTitle", view: subTitleTextField) + addFormRow(label: "Hide Button Group", view: buttonGroupToggle) + addFormRow(label: "First Button Text", view: firstButtonTextField) + addFormRow(label: "Second Button Text", view: secondButtonTextField) + + titleTextField.textPublisher.sink { newString in + self.notificationView.titleText = newString + }.store(in: &subscribers) + + subTitleTextField.textPublisher.sink { newString in + self.notificationView.subTitleText = newString + }.store(in: &subscribers) + + buttonGroupToggle.publisher(for: .valueChanged).sink { [weak self] toggle in + if toggle.isOn { + self?.notificationView.primaryButtonModel = nil + self?.notificationView.secondaryButtonModel = nil + } else { + self?.setupButtons(with: self?.firstButtonDefaultText, secondButtonText: self?.secondButtonDefaultText) + } + }.store(in: &subscribers) + + + firstButtonTextField.textPublisher.sink { newString in + + if newString.isEmpty { + self.notificationView.primaryButtonModel = nil + self.notificationView.secondaryButtonModel = nil + } else { + self.setupButtons(with: newString, secondButtonText: self.secondButtonTextField.text) + } + + }.store(in: &subscribers) + + secondButtonTextField.textPublisher.sink { newString in + if !(self.firstButtonTextField.text?.isEmpty ?? true){ + self.setupButtons(secondButtonText: newString) + } + }.store(in: &subscribers) } func setupPicker() { @@ -51,4 +102,18 @@ class NotificationViewController: BaseViewController { } } + + func setupButtons(with firstButtonText: String? = nil, secondButtonText: String? = nil) { + if let firstButtonText { + notificationView.primaryButtonModel = .init(text: firstButtonText, onClick: { button in + print("\(button.text!) button click") + }) + } + + if let secondButtonText { + notificationView.secondaryButtonModel = .init(text: secondButtonText, onClick: { button in + print("\(button.text!) button click") + }) + } + } } From 349ec343d2ead6c98112c4a974a124319d6fe75c Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 28 Mar 2023 11:27:37 -0500 Subject: [PATCH 4/8] updated text Signed-off-by: Matt Bruce --- VDSSample/ViewControllers/ButtonViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VDSSample/ViewControllers/ButtonViewController.swift b/VDSSample/ViewControllers/ButtonViewController.swift index 2ca100a..2844b06 100644 --- a/VDSSample/ViewControllers/ButtonViewController.swift +++ b/VDSSample/ViewControllers/ButtonViewController.swift @@ -48,7 +48,7 @@ class ButtonViewController: BaseViewController { addFormRow(label: "Surface", view: surfacePickerSelectorView) addFormRow(label: "Use", view: usePickerSelectorView) addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch)) - addFormRow(label: "Label", view: textField) + addFormRow(label: "Text", view: textField) addFormRow(label: "Width", view: widthTextField) addFormRow(label: "Size", view: buttonSizePickerSelectorView) From 134f45795a3330fa40463b4d7e05f4fec91d7cc8 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 28 Mar 2023 13:21:43 -0500 Subject: [PATCH 5/8] added visual label for click Signed-off-by: Matt Bruce --- .../ViewControllers/NotificationViewController.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift index 0856eed..2700606 100644 --- a/VDSSample/ViewControllers/NotificationViewController.swift +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -11,6 +11,7 @@ import VDS class NotificationViewController: BaseViewController { var notificationView = Notification() + let label = Label() let titleTextField = TextField() let subTitleTextField = TextField() let buttonGroupToggle = Toggle() @@ -52,6 +53,7 @@ class NotificationViewController: BaseViewController { addFormRow(label: "Title", view: titleTextField) addFormRow(label: "SubTitle", view: subTitleTextField) addFormRow(label: "Hide Button Group", view: buttonGroupToggle) + addFormRow(label: "Button Action", view: label) addFormRow(label: "First Button Text", view: firstButtonTextField) addFormRow(label: "Second Button Text", view: secondButtonTextField) @@ -67,6 +69,7 @@ class NotificationViewController: BaseViewController { if toggle.isOn { self?.notificationView.primaryButtonModel = nil self?.notificationView.secondaryButtonModel = nil + self?.label.text = "" } else { self?.setupButtons(with: self?.firstButtonDefaultText, secondButtonText: self?.secondButtonDefaultText) } @@ -105,14 +108,14 @@ class NotificationViewController: BaseViewController { func setupButtons(with firstButtonText: String? = nil, secondButtonText: String? = nil) { if let firstButtonText { - notificationView.primaryButtonModel = .init(text: firstButtonText, onClick: { button in - print("\(button.text!) button click") + notificationView.primaryButtonModel = .init(text: firstButtonText, onClick: { [weak self] button in + self?.label.text = "\(button.text!) button click" }) } if let secondButtonText { - notificationView.secondaryButtonModel = .init(text: secondButtonText, onClick: { button in - print("\(button.text!) button click") + notificationView.secondaryButtonModel = .init(text: secondButtonText, onClick: { [weak self] button in + self?.label.text = "\(button.text!) button click" }) } } From bcb6bbf7cfb482d11a9ec056b01e8cebbd2ec850 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 29 Mar 2023 14:11:53 -0500 Subject: [PATCH 6/8] updated ui Signed-off-by: Matt Bruce --- VDSSample/Classes/Helper.swift | 25 +++++++++---------- VDSSample/Protocols/PickerBase.swift | 18 ++++++------- .../CheckboxViewController.swift | 2 +- .../TileContainerViewController.swift | 13 ++++------ .../TileletViewController.swift | 10 ++++---- 5 files changed, 31 insertions(+), 37 deletions(-) diff --git a/VDSSample/Classes/Helper.swift b/VDSSample/Classes/Helper.swift index ae446bd..de7b63a 100644 --- a/VDSSample/Classes/Helper.swift +++ b/VDSSample/Classes/Helper.swift @@ -24,21 +24,20 @@ extension UIView { } } -extension ButtonBase { +extension Clickable where Self: ButtonBase { func labelPublisher(_ label: UILabel){ - onClickSubscriber = publisher(for: .touchUpInside) - .sink { control in - let newText = "\(control.text!) clicked - " - if let labelText = label.text { - let components = labelText.components(separatedBy: " - ") - let last: String = (components.last ?? "0").trimmingCharacters(in: .whitespaces) - let count = Int(last)! - label.text = "\(newText)\(count+1)" - } else { - label.text = "\(newText)1" - } - print("clicked me") + onClick = { control in + let newText = "\(control.text!) clicked - " + if let labelText = label.text { + let components = labelText.components(separatedBy: " - ") + let last: String = (components.last ?? "0").trimmingCharacters(in: .whitespaces) + let count = Int(last)! + label.text = "\(newText)\(count+1)" + } else { + label.text = "\(newText)1" } + print("clicked me") + } } } diff --git a/VDSSample/Protocols/PickerBase.swift b/VDSSample/Protocols/PickerBase.swift index a674209..d589d37 100644 --- a/VDSSample/Protocols/PickerBase.swift +++ b/VDSSample/Protocols/PickerBase.swift @@ -74,16 +74,14 @@ public class PickerSelectorView: UIStackView, Picker updateSelectedIndex() addArrangedSubview(label) addArrangedSubview(button) - button - .publisher(for: .touchUpInside) - .sink { [weak self] _ in - self?.picker?.delegate = self - self?.picker?.dataSource = self - self?.picker?.reloadAllComponents() - self?.picker?.selectRow(self?.selectedIndex ?? 0, inComponent: 0, animated: false) - self?.picker?.isHidden = false - self?.scrollToBottom?() - }.store(in: &subscribers) + button.onClick = { [weak self] _ in + self?.picker?.delegate = self + self?.picker?.dataSource = self + self?.picker?.reloadAllComponents() + self?.picker?.selectRow(self?.selectedIndex ?? 0, inComponent: 0, animated: false) + self?.picker?.isHidden = false + self?.scrollToBottom?() + } } func updateSelectedIndex() { 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/TileContainerViewController.swift b/VDSSample/ViewControllers/TileContainerViewController.swift index 7f249c0..d9d72fd 100644 --- a/VDSSample/ViewControllers/TileContainerViewController.swift +++ b/VDSSample/ViewControllers/TileContainerViewController.swift @@ -36,7 +36,6 @@ class TileContainerViewController: BaseViewController { }() var clickableSwitch = Toggle() - var clickableCancel: AnyCancellable? var showBackgroundImageSwitch = Toggle() var showBorderSwitch = Toggle() @@ -78,15 +77,13 @@ class TileContainerViewController: BaseViewController { clickableSwitch .publisher(for: .valueChanged) .sink { [weak self] sender in + guard let self else { return } if sender.isOn { - self?.clickableCancel = self?.tileContainer - .publisher(for: .touchUpInside) - .sink(receiveValue: { _ in - print("you click on me!") - }) + self.tileContainer.onClick = { _ in + print("you click on me!") + } } else { - self?.clickableCancel?.cancel() - self?.clickableCancel = nil + self.tileContainer.onClick = nil } }.store(in: &subscribers) diff --git a/VDSSample/ViewControllers/TileletViewController.swift b/VDSSample/ViewControllers/TileletViewController.swift index 23533b8..d3e5ed5 100644 --- a/VDSSample/ViewControllers/TileletViewController.swift +++ b/VDSSample/ViewControllers/TileletViewController.swift @@ -79,13 +79,13 @@ class TileletViewController: BaseViewController { .sink { [weak self] sender in guard let tilelet = self?.tilelet else { return } if sender.isOn { - tilelet.onClickSubscriber = tilelet.publisher(for: .touchUpInside) - .sink(receiveValue: { _ in - print("you click on me!") - }) + tilelet.onClick = { t in + print("you click on me!") + } + } else { + tilelet.onClick = nil } }.store(in: &subscribers) - widthTextField .textPublisher .sink { [weak self] text in From fa502dca98ea768bd67e1a8828aeb1210cce0bdb Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 29 Mar 2023 15:48:54 -0500 Subject: [PATCH 7/8] showing onCloseClick in console Signed-off-by: Matt Bruce --- VDSSample/ViewControllers/NotificationViewController.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift index 2700606..330321e 100644 --- a/VDSSample/ViewControllers/NotificationViewController.swift +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -57,6 +57,10 @@ class NotificationViewController: BaseViewController { addFormRow(label: "First Button Text", view: firstButtonTextField) addFormRow(label: "Second Button Text", view: secondButtonTextField) + notificationView.onCloseClick = { notification in + print("onCloseClick: \(notification.titleText)") + } + titleTextField.textPublisher.sink { newString in self.notificationView.titleText = newString }.store(in: &subscribers) From 645c7d5815e058265f1bcb002e42748f7d6ac288 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 30 Mar 2023 10:12:37 -0500 Subject: [PATCH 8/8] updated Signed-off-by: Matt Bruce --- VDSSample/Classes/Helper.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VDSSample/Classes/Helper.swift b/VDSSample/Classes/Helper.swift index de7b63a..22611ef 100644 --- a/VDSSample/Classes/Helper.swift +++ b/VDSSample/Classes/Helper.swift @@ -24,7 +24,7 @@ extension UIView { } } -extension Clickable where Self: ButtonBase { +extension ButtonBase { func labelPublisher(_ label: UILabel){ onClick = { control in let newText = "\(control.text!) clicked - "