From 0decdb5a1685189f0fc9f5435ebec1015ba2f8b2 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 9 Aug 2024 13:19:33 -0500 Subject: [PATCH] add the touchUpInside since this is the only one using this Signed-off-by: Matt Bruce --- .../Icon/ButtonIcon/ButtonIcon.swift | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift index bf8a50f7..95406fb4 100644 --- a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift +++ b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift @@ -402,17 +402,15 @@ open class ButtonIcon: Control, Changeable { centerXConstraint?.activate() centerYConstraint = icon.centerYAnchor.constraint(equalTo: iconLayoutGuide.centerYAnchor, constant: 0) centerYConstraint?.activate() - } - - /// Executed on initialization for this View. - open override func initialSetup() { - super.initialSetup() - onClick = { control in - guard control.isEnabled else { return } - if control.selectedIconName != nil && control.selectable { - control.toggle() - } - } + + publisher(for: .touchUpInside) + .sink(receiveValue: { [weak self] _ in + guard let self, isEnabled, + selectedIconName != nil, + selectable else { return } + toggle() + }) + .store(in: &subscribers) } /// This will change the state of the Selector and execute the actionBlock if provided.