fixed bug for enable hightlight

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-01-12 08:10:53 -06:00
parent e72c751842
commit 48281da2e1

View File

@ -13,10 +13,12 @@ import Combine
public final class UIControlSubscription<SubscriberType: Subscriber, Control: UIControl>: Subscription where SubscriberType.Input == Control {
private var subscriber: SubscriberType?
private let control: Control
private let event: UIControl.Event
public init(subscriber: SubscriberType, control: Control, event: UIControl.Event) {
self.subscriber = subscriber
self.control = control
self.event = event
//allow highlight for VDS.Controls on "onClick" events
if let c = control as? VDS.Control, event == .touchUpInside {
@ -34,6 +36,13 @@ public final class UIControlSubscription<SubscriberType: Subscriber, Control: UI
public func cancel() {
subscriber = nil
}
deinit {
//remove highlight for VDS.Controls on "onClick" events
if let c = control as? VDS.Control, event == .touchUpInside {
c.enabledHighlight = false
}
}
@objc private func eventHandler() {
_ = subscriber?.receive(control)