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