fix errors with RxCocoa introduced by merge

This commit is contained in:
Jamie Pinkham 2016-06-22 10:15:37 -04:00
parent 7ff150aafc
commit 5d47db7609
5 changed files with 20 additions and 19 deletions

View File

@ -53,7 +53,7 @@ extension DriverConvertibleType {
- returns: Object representing subscription. - returns: Object representing subscription.
*/ */
@warn_unused_result(message:"http://git.io/rxs.ud") @warn_unused_result(message:"http://git.io/rxs.ud")
public func drive<R>(_ transformation: Observable<E> -> R) -> R { public func drive<R>(_ transformation: (Observable<E>) -> R) -> R {
MainScheduler.ensureExecutingOnScheduler(errorMessage: driverErrorMessage) MainScheduler.ensureExecutingOnScheduler(errorMessage: driverErrorMessage)
return transformation(self.asObservable()) return transformation(self.asObservable())
} }
@ -73,7 +73,7 @@ extension DriverConvertibleType {
- returns: Object representing subscription. - returns: Object representing subscription.
*/ */
@warn_unused_result(message:"http://git.io/rxs.ud") @warn_unused_result(message:"http://git.io/rxs.ud")
public func drive<R1, R2>(_ with: Observable<E> -> R1 -> R2, curriedArgument: R1) -> R2 { public func drive<R1, R2>(_ with: (Observable<E>) -> (R1) -> R2, curriedArgument: R1) -> R2 {
MainScheduler.ensureExecutingOnScheduler(errorMessage: driverErrorMessage) MainScheduler.ensureExecutingOnScheduler(errorMessage: driverErrorMessage)
return with(self.asObservable())(curriedArgument) return with(self.asObservable())(curriedArgument)
} }
@ -105,7 +105,7 @@ extension DriverConvertibleType {
- returns: Subscription object used to unsubscribe from the observable sequence. - returns: Subscription object used to unsubscribe from the observable sequence.
*/ */
@warn_unused_result(message:"http://git.io/rxs.ud") @warn_unused_result(message:"http://git.io/rxs.ud")
public func driveNext(_ onNext: E -> Void) -> Disposable { public func driveNext(_ onNext: (E) -> Void) -> Disposable {
MainScheduler.ensureExecutingOnScheduler(errorMessage: driverErrorMessage) MainScheduler.ensureExecutingOnScheduler(errorMessage: driverErrorMessage)
return self.asObservable().subscribeNext(onNext) return self.asObservable().subscribeNext(onNext)
} }

View File

@ -25,7 +25,7 @@ public class RxTabBarDelegateProxy
/** /**
For more information take a look at `DelegateProxyType`. For more information take a look at `DelegateProxyType`.
*/ */
public class func currentDelegateFor(object: AnyObject) -> AnyObject? { public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
let tabBar: UITabBar = castOrFatalError(object) let tabBar: UITabBar = castOrFatalError(object)
return tabBar.delegate return tabBar.delegate
} }
@ -33,7 +33,7 @@ public class RxTabBarDelegateProxy
/** /**
For more information take a look at `DelegateProxyType`. For more information take a look at `DelegateProxyType`.
*/ */
public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) { public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
let tabBar: UITabBar = castOrFatalError(object) let tabBar: UITabBar = castOrFatalError(object)
tabBar.delegate = castOptionalOrFatalError(delegate) tabBar.delegate = castOptionalOrFatalError(delegate)
} }
@ -41,7 +41,7 @@ public class RxTabBarDelegateProxy
/** /**
For more information take a look at `DelegateProxyType`. For more information take a look at `DelegateProxyType`.
*/ */
public override class func createProxyForObject(object: AnyObject) -> AnyObject { public override class func createProxyForObject(_ object: AnyObject) -> AnyObject {
let tabBar = (object as! UITabBar) let tabBar = (object as! UITabBar)
return castOrFatalError(tabBar.rx_createDelegateProxy()) return castOrFatalError(tabBar.rx_createDelegateProxy())

View File

@ -52,7 +52,7 @@ extension UIScrollView {
*/ */
public var rx_scrollEnabled: AnyObserver<Bool> { public var rx_scrollEnabled: AnyObserver<Bool> {
return UIBindingObserver(UIElement: self) { scrollView, scrollEnabled in return UIBindingObserver(UIElement: self) { scrollView, scrollEnabled in
scrollView.scrollEnabled = scrollEnabled scrollView.isScrollEnabled = scrollEnabled
}.asObserver() }.asObserver()
} }

View File

@ -24,7 +24,8 @@ extension UITabBar {
Reactive wrapper for `delegate` message `tabBar:willBeginCustomizingItems:`. Reactive wrapper for `delegate` message `tabBar:willBeginCustomizingItems:`.
*/ */
public var rx_willBeginCustomizing: ControlEvent<[UITabBarItem]> { public var rx_willBeginCustomizing: ControlEvent<[UITabBarItem]> {
let source = rx_delegate.observe(#selector(UITabBarDelegate.tabBar(_:willBeginCustomizingItems:)))
let source = rx_delegate.observe(#selector(UITabBarDelegate.tabBar(_:willBeginCustomizing:)))
.map { a in .map { a in
return try castOrThrow([UITabBarItem].self, a[1]) return try castOrThrow([UITabBarItem].self, a[1])
} }
@ -36,7 +37,7 @@ extension UITabBar {
Reactive wrapper for `delegate` message `tabBar:didBeginCustomizingItems:`. Reactive wrapper for `delegate` message `tabBar:didBeginCustomizingItems:`.
*/ */
public var rx_didBeginCustomizing: ControlEvent<[UITabBarItem]> { public var rx_didBeginCustomizing: ControlEvent<[UITabBarItem]> {
let source = rx_delegate.observe(#selector(UITabBarDelegate.tabBar(_:didBeginCustomizingItems:))) let source = rx_delegate.observe(#selector(UITabBarDelegate.tabBar(_:didBeginCustomizing:)))
.map { a in .map { a in
return try castOrThrow([UITabBarItem].self, a[1]) return try castOrThrow([UITabBarItem].self, a[1])
} }
@ -47,8 +48,8 @@ extension UITabBar {
/** /**
Reactive wrapper for `delegate` message `tabBar:willEndCustomizingItems:changed:`. Reactive wrapper for `delegate` message `tabBar:willEndCustomizingItems:changed:`.
*/ */
public var rx_willEndCustomizing: ControlEvent<(items: [UITabBarItem], changed: Bool)> { public var rx_willEndCustomizing: ControlEvent<([UITabBarItem], Bool)> {
let source = rx_delegate.observe(#selector(UITabBarDelegate.tabBar(_:willEndCustomizingItems:changed:))) let source = rx_delegate.observe(#selector(UITabBarDelegate.tabBar(_:willEndCustomizing:changed:)))
.map { (a: [AnyObject]) -> (([UITabBarItem], Bool)) in .map { (a: [AnyObject]) -> (([UITabBarItem], Bool)) in
let items = try castOrThrow([UITabBarItem].self, a[1]) let items = try castOrThrow([UITabBarItem].self, a[1])
let changed = try castOrThrow(Bool.self, a[2]) let changed = try castOrThrow(Bool.self, a[2])
@ -61,8 +62,8 @@ extension UITabBar {
/** /**
Reactive wrapper for `delegate` message `tabBar:didEndCustomizingItems:changed:`. Reactive wrapper for `delegate` message `tabBar:didEndCustomizingItems:changed:`.
*/ */
public var rx_didEndCustomizing: ControlEvent<(items: [UITabBarItem], changed: Bool)> { public var rx_didEndCustomizing: ControlEvent<([UITabBarItem], Bool)> {
let source = rx_delegate.observe(#selector(UITabBarDelegate.tabBar(_:didEndCustomizingItems:changed:))) let source = rx_delegate.observe(#selector(UITabBarDelegate.tabBar(_:didEndCustomizing:changed:)))
.map { (a: [AnyObject]) -> (([UITabBarItem], Bool)) in .map { (a: [AnyObject]) -> (([UITabBarItem], Bool)) in
let items = try castOrThrow([UITabBarItem].self, a[1]) let items = try castOrThrow([UITabBarItem].self, a[1])
let changed = try castOrThrow(Bool.self, a[2]) let changed = try castOrThrow(Bool.self, a[2])
@ -102,7 +103,7 @@ extension UITabBar {
Reactive wrapper for `delegate` message `tabBar:didSelectItem:`. Reactive wrapper for `delegate` message `tabBar:didSelectItem:`.
*/ */
public var rx_didSelectItem: ControlEvent<UITabBarItem> { public var rx_didSelectItem: ControlEvent<UITabBarItem> {
let source = rx_delegate.observe(#selector(UITabBarDelegate.tabBar(_:didSelectItem:))) let source = rx_delegate.observe(#selector(UITabBarDelegate.tabBar(_:didSelect:)))
.map { a in .map { a in
return try castOrThrow(UITabBarItem.self, a[1]) return try castOrThrow(UITabBarItem.self, a[1])
} }

View File

@ -49,12 +49,12 @@ public final class MainScheduler : SerialDispatchQueueScheduler {
} }
} }
override func scheduleInternal<StateType>(_ state: StateType, action: StateType -> Disposable) -> Disposable { override func scheduleInternal<StateType>(_ state: StateType, action: (StateType) -> Disposable) -> Disposable {
let currentNumberEnqueued = AtomicIncrement(&numberEnqueued) let currentNumberEnqueued = AtomicIncrement(&numberEnqueued)
if Thread.current().isMainThread && currentNumberEnqueued == 1 { if Thread.current().isMainThread && currentNumberEnqueued == 1 {
let disposable = action(state) let disposable = action(state)
AtomicDecrement(&numberEnqueued) _ = AtomicDecrement(&numberEnqueued)
return disposable return disposable
} }
@ -62,10 +62,10 @@ public final class MainScheduler : SerialDispatchQueueScheduler {
_mainQueue.async { _mainQueue.async {
if !cancel.disposed { if !cancel.disposed {
action(state) _ = action(state)
} }
AtomicDecrement(&self.numberEnqueued) _ = AtomicDecrement(&self.numberEnqueued)
} }
return cancel return cancel