Adds `UIButton.setTitle` extensions to tvOS.
This commit is contained in:
parent
7a15347943
commit
933cb02cb0
|
|
@ -22,15 +22,6 @@ extension UIButton {
|
|||
public var rx_tap: ControlEvent<Void> {
|
||||
return rx_controlEvent(.TouchUpInside)
|
||||
}
|
||||
|
||||
/**
|
||||
Reactive wrapper for `setTitle(_:controlState:)`
|
||||
*/
|
||||
public func rx_title(controlState: UIControlState = .Normal) -> AnyObserver<String?> {
|
||||
return UIBindingObserver<UIButton, String?>(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<String?> {
|
||||
return UIBindingObserver<UIButton, String?>(UIElement: self) { (button, title) -> () in
|
||||
button.setTitle(title, forState: controlState)
|
||||
}.asObserver()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Loading…
Reference in New Issue