RxSwift/RxCocoa/iOS/UIRefreshControl+Rx.swift
Jérôme Alves 10ff55cfba Moves RxCocoa extensions from rx_ syntax to rx. syntax.
The main work is done in this commit but the feature it's still "work in progress"
2016-08-09 00:17:38 +02:00

34 lines
685 B
Swift

//
// UIRefreshControl+Rx.swift
// RxCocoa
//
// Created by Yosuke Ishikawa on 1/31/16.
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
//
#if os(iOS)
import UIKit
#if !RX_NO_MODULE
import RxSwift
#endif
extension Reactive where Base: UIRefreshControl {
/**
Bindable sink for `beginRefreshing()`, `endRefreshing()` methods.
*/
public var refreshing: AnyObserver<Bool> {
return UIBindingObserver(UIElement: self.base) { refreshControl, refresh in
if refresh {
refreshControl.beginRefreshing()
} else {
refreshControl.endRefreshing()
}
}.asObserver()
}
}
#endif