fixed bug for enable hightlight
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
e72c751842
commit
48281da2e1
@ -13,10 +13,12 @@ import Combine
|
|||||||
public final class UIControlSubscription<SubscriberType: Subscriber, Control: UIControl>: Subscription where SubscriberType.Input == Control {
|
public final class UIControlSubscription<SubscriberType: Subscriber, Control: UIControl>: Subscription where SubscriberType.Input == Control {
|
||||||
private var subscriber: SubscriberType?
|
private var subscriber: SubscriberType?
|
||||||
private let control: Control
|
private let control: Control
|
||||||
|
private let event: UIControl.Event
|
||||||
|
|
||||||
public init(subscriber: SubscriberType, control: Control, event: UIControl.Event) {
|
public init(subscriber: SubscriberType, control: Control, event: UIControl.Event) {
|
||||||
self.subscriber = subscriber
|
self.subscriber = subscriber
|
||||||
self.control = control
|
self.control = control
|
||||||
|
self.event = event
|
||||||
|
|
||||||
//allow highlight for VDS.Controls on "onClick" events
|
//allow highlight for VDS.Controls on "onClick" events
|
||||||
if let c = control as? VDS.Control, event == .touchUpInside {
|
if let c = control as? VDS.Control, event == .touchUpInside {
|
||||||
@ -34,6 +36,13 @@ public final class UIControlSubscription<SubscriberType: Subscriber, Control: UI
|
|||||||
public func cancel() {
|
public func cancel() {
|
||||||
subscriber = nil
|
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() {
|
@objc private func eventHandler() {
|
||||||
_ = subscriber?.receive(control)
|
_ = subscriber?.receive(control)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user