From 89b200c005696c592a39c8f619b878af2655a1ef Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 8 Dec 2022 11:03:13 -0600 Subject: [PATCH] added highlight Signed-off-by: Matt Bruce --- VDS/Classes/Control.swift | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/VDS/Classes/Control.swift b/VDS/Classes/Control.swift index 90dae4e5..d5af7f46 100644 --- a/VDS/Classes/Control.swift +++ b/VDS/Classes/Control.swift @@ -29,8 +29,24 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable { open override var isSelected: Bool { didSet { didChange() } } - open override var isHighlighted: Bool { didSet { updateView() } } - + var isHighlightAnimating = false + open override var isHighlighted: Bool { + didSet { + if isHighlightAnimating == false { + isHighlightAnimating = true + UIView.animate(withDuration: 0.1, animations: { [weak self] in + self?.updateView() + }) { [weak self] _ in + //you update the view since this is typically a quick change + UIView.animate(withDuration: 0.1, animations: { [weak self] in + self?.updateView() + self?.isHighlightAnimating = false + }) + } + } + } + } + open override var isEnabled: Bool { get { !disabled } set {