RxSwift/RxCocoa/iOS/UIButton+Rx.swift

49 lines
756 B
Swift
Raw Normal View History

//
// UIButton+Rx.swift
// RxCocoa
//
// Created by Krunoslav Zaher on 3/28/15.
2015-12-29 18:56:21 +03:00
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
#if os(iOS)
import Foundation
2015-08-01 16:13:26 +03:00
#if !RX_NO_MODULE
2015-04-10 02:52:51 +03:00
import RxSwift
2015-08-01 16:13:26 +03:00
#endif
import UIKit
extension UIButton {
2015-09-09 12:29:39 +03:00
/**
Reactive wrapper for `TouchUpInside` control event.
*/
public var rx_tap: ControlEvent<Void> {
2015-12-21 05:02:24 +03:00
return rx_controlEvent(.TouchUpInside)
}
}
#endif
#if os(tvOS)
import Foundation
#if !RX_NO_MODULE
import RxSwift
#endif
import UIKit
extension UIButton {
/**
Reactive wrapper for `PrimaryActionTriggered` control event.
*/
public var rx_primaryAction: ControlEvent<Void> {
2015-12-21 05:02:24 +03:00
return rx_controlEvent(.PrimaryActionTriggered)
}
}
#endif