From ad6c00214e83bc821faecc4c6c061f1823f4ef38 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 14 Sep 2023 08:31:51 -0500 Subject: [PATCH] removing touchUpInsideCount, since now we are keying off of onClickSubscriber Signed-off-by: Matt Bruce --- VDS/BaseClasses/Control.swift | 4 +--- VDS/Components/Buttons/ButtonBase.swift | 4 +--- VDS/Protocols/Clickable.swift | 2 -- VDS/Publishers/UIControlPublisher.swift | 11 ----------- 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/VDS/BaseClasses/Control.swift b/VDS/BaseClasses/Control.swift index b2f3d4ae..e9535f1a 100644 --- a/VDS/BaseClasses/Control.swift +++ b/VDS/BaseClasses/Control.swift @@ -62,15 +62,13 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable { /// Whether the Control can handle the isHighlighted state. open var canHighlight: Bool = true - - open var touchUpInsideCount: Int = 0 var isHighlightAnimating = false /// Whether the Control is highlighted or not. open override var isHighlighted: Bool { didSet { - if canHighlight && isHighlightAnimating == false && touchUpInsideCount > 0 { + if canHighlight && isHighlightAnimating == false && onClickSubscriber != nil { isHighlightAnimating = true UIView.animate(withDuration: 0.1, animations: { [weak self] in self?.setNeedsUpdate() diff --git a/VDS/Components/Buttons/ButtonBase.swift b/VDS/Components/Buttons/ButtonBase.swift index e505b7f8..2c377d1c 100644 --- a/VDS/Components/Buttons/ButtonBase.swift +++ b/VDS/Components/Buttons/ButtonBase.swift @@ -96,15 +96,13 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable { open var useScaledFont: Bool = false { didSet { setNeedsUpdate() } } open var userInfo = [String: Primitive]() - - open var touchUpInsideCount: Int = 0 internal var isHighlightAnimating = false /// Whether the Control is highlighted or not. open override var isHighlighted: Bool { didSet { - if isHighlightAnimating == false && touchUpInsideCount > 0 { + if isHighlightAnimating == false && onClickSubscriber != nil { isHighlightAnimating = true UIView.animate(withDuration: 0.1, animations: { [weak self] in self?.setNeedsUpdate() diff --git a/VDS/Protocols/Clickable.swift b/VDS/Protocols/Clickable.swift index 50445dc0..b8c49a88 100644 --- a/VDS/Protocols/Clickable.swift +++ b/VDS/Protocols/Clickable.swift @@ -10,8 +10,6 @@ import UIKit import Combine public protocol Clickable: ViewProtocol where Self: UIControl { - /// Reference count used when a subscriber is listening for the UIControl event .touchUpInside. - var touchUpInsideCount: Int { get set } /// Sets the primary Subscriber used for the UIControl event .touchUpInside. var onClickSubscriber: AnyCancellable? { get set } } diff --git a/VDS/Publishers/UIControlPublisher.swift b/VDS/Publishers/UIControlPublisher.swift index 6b8fa45d..711966f0 100644 --- a/VDS/Publishers/UIControlPublisher.swift +++ b/VDS/Publishers/UIControlPublisher.swift @@ -20,10 +20,6 @@ public final class UIControlSubscription 0 { - c.touchUpInsideCount -= 1 - } - } @objc private func eventHandler() { _ = subscriber?.receive(control)