added highlight

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-12-08 11:03:13 -06:00
parent bd96705b4e
commit 89b200c005

View File

@ -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 {