From 37d88af775821fca96c26cd163b5649d5c38a78c Mon Sep 17 00:00:00 2001 From: darko55555 Date: Sun, 7 Feb 2021 22:16:14 +0100 Subject: [PATCH] Add isEnabledPublisher to UIButton --- Sources/CombineCocoa/Controls/UIButton+Combine.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/CombineCocoa/Controls/UIButton+Combine.swift b/Sources/CombineCocoa/Controls/UIButton+Combine.swift index a249ad3..edc6fcc 100644 --- a/Sources/CombineCocoa/Controls/UIButton+Combine.swift +++ b/Sources/CombineCocoa/Controls/UIButton+Combine.swift @@ -16,5 +16,10 @@ public extension UIButton { var tapPublisher: AnyPublisher { controlEventPublisher(for: .touchUpInside) } + + var isEnabledPublisher: AnyPublisher { + Publishers.ControlProperty(control: self, events: .defaultValueEvents, keyPath: \.isEnabled) + .eraseToAnyPublisher() + } } #endif