From 933cb02cb01a07b2e9d76919ee7151806e3eb1f3 Mon Sep 17 00:00:00 2001 From: Krunoslav Zaher Date: Sun, 26 Jun 2016 14:37:10 +0200 Subject: [PATCH] Adds `UIButton.setTitle` extensions to tvOS. --- RxCocoa/iOS/UIButton+Rx.swift | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/RxCocoa/iOS/UIButton+Rx.swift b/RxCocoa/iOS/UIButton+Rx.swift index a8d072bb..f3adca37 100644 --- a/RxCocoa/iOS/UIButton+Rx.swift +++ b/RxCocoa/iOS/UIButton+Rx.swift @@ -22,15 +22,6 @@ extension UIButton { public var rx_tap: ControlEvent { return rx_controlEvent(.TouchUpInside) } - - /** - Reactive wrapper for `setTitle(_:controlState:)` - */ - public func rx_title(controlState: UIControlState = .Normal) -> AnyObserver { - return UIBindingObserver(UIElement: self) { (button, title) -> () in - button.setTitle(title, forState: controlState) - }.asObserver() - } } #endif @@ -55,3 +46,23 @@ extension UIButton { } #endif + +#if os(iOS) || os(tvOS) + + import Foundation +#if !RX_NO_MODULE + import RxSwift +#endif + import UIKit + +extension UIButton { + /** + Reactive wrapper for `setTitle(_:controlState:)` + */ + public func rx_title(controlState: UIControlState = .Normal) -> AnyObserver { + return UIBindingObserver(UIElement: self) { (button, title) -> () in + button.setTitle(title, forState: controlState) + }.asObserver() + } +} +#endif \ No newline at end of file