From 695ea19e02c6e330a7b9c5eb34e2d5ba1334869b Mon Sep 17 00:00:00 2001 From: Mo Ramezanpoor Date: Tue, 16 Aug 2016 15:30:11 +0100 Subject: [PATCH] WIP: Fixes warnings in RxCocoa. --- .../Driver/Driver+Operators+arity.swift | 28 +++++++++---------- .../Driver/Driver+Operators+arity.tt | 4 +-- .../Driver/Driver+Subscription.swift | 2 +- .../ObservableConvertibleType+Driver.swift | 4 +-- .../Common/CocoaUnits/UIBindingObserver.swift | 2 +- RxCocoa/Common/DelegateProxy.swift | 8 +++--- RxCocoa/Common/Observable+Bind.swift | 2 +- .../Implementations/KVOObserver.swift | 2 +- .../Implementations/MessageSentObserver.swift | 6 ++-- .../Common/Observables/NSURLSession+Rx.swift | 8 +++--- RxCocoa/Common/_RXDelegateProxy.h | 4 +++ RxCocoa/iOS/UIBarButtonItem+Rx.swift | 2 +- RxCocoa/iOS/UICollectionView+Rx.swift | 16 +++++------ RxCocoa/iOS/UIControl+Rx.swift | 2 +- 14 files changed, 47 insertions(+), 43 deletions(-) diff --git a/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators+arity.swift b/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators+arity.swift index 4d2acd3f..c1b3731b 100644 --- a/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators+arity.swift +++ b/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators+arity.swift @@ -25,7 +25,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func zip - (_ source1: O1, _ source2: O2, resultSelector: (O1.E, O2.E) throws -> E) + (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.E, O2.E) throws -> E) -> Driver { let source = Observable.zip( source1.asDriver().asObservable(), source2.asDriver().asObservable(), @@ -45,7 +45,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func combineLatest - (_ source1: O1, _ source2: O2, resultSelector: (O1.E, O2.E) throws -> E) + (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.E, O2.E) throws -> E) -> Driver { let source = Observable.combineLatest( source1.asDriver().asObservable(), source2.asDriver().asObservable(), @@ -69,7 +69,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func zip - (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: (O1.E, O2.E, O3.E) throws -> E) + (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.E, O2.E, O3.E) throws -> E) -> Driver { let source = Observable.zip( source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), @@ -89,7 +89,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func combineLatest - (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: (O1.E, O2.E, O3.E) throws -> E) + (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.E, O2.E, O3.E) throws -> E) -> Driver { let source = Observable.combineLatest( source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), @@ -113,7 +113,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func zip - (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: (O1.E, O2.E, O3.E, O4.E) throws -> E) + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E) throws -> E) -> Driver { let source = Observable.zip( source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), @@ -133,7 +133,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func combineLatest - (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: (O1.E, O2.E, O3.E, O4.E) throws -> E) + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E) throws -> E) -> Driver { let source = Observable.combineLatest( source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), @@ -157,7 +157,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func zip - (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E) + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E) -> Driver { let source = Observable.zip( source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), @@ -177,7 +177,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func combineLatest - (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E) + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E) -> Driver { let source = Observable.combineLatest( source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), @@ -201,7 +201,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func zip - (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E) throws -> E) + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E) throws -> E) -> Driver { let source = Observable.zip( source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(), @@ -221,7 +221,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func combineLatest - (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E) throws -> E) + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E) throws -> E) -> Driver { let source = Observable.combineLatest( source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(), @@ -245,7 +245,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func zip - (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E) throws -> E) + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E) throws -> E) -> Driver { let source = Observable.zip( source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(), source7.asDriver().asObservable(), @@ -265,7 +265,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func combineLatest - (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E) throws -> E) + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E) throws -> E) -> Driver { let source = Observable.combineLatest( source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(), source7.asDriver().asObservable(), @@ -289,7 +289,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func zip - (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E) throws -> E) + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E) throws -> E) -> Driver { let source = Observable.zip( source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(), source7.asDriver().asObservable(), source8.asDriver().asObservable(), @@ -309,7 +309,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func combineLatest - (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E) throws -> E) + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E) throws -> E) -> Driver { let source = Observable.combineLatest( source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(), source7.asDriver().asObservable(), source8.asDriver().asObservable(), diff --git a/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators+arity.tt b/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators+arity.tt index 4dca25e0..650dcbe4 100644 --- a/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators+arity.tt +++ b/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators+arity.tt @@ -24,7 +24,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func zip<<%= (Array(1...i).map { "O\($0): DriverConvertibleType" }).joined(separator: ", ") %>> - (<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>, resultSelector: (<%= (Array(1...i).map { "O\($0).E" }).joined(separator: ", ") %>) throws -> E) + (<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>, resultSelector: @escaping (<%= (Array(1...i).map { "O\($0).E" }).joined(separator: ", ") %>) throws -> E) -> Driver { let source = Observable.zip( <%= (Array(1...i).map { "source\($0).asDriver().asObservable()" }).joined(separator: ", ") %>, @@ -44,7 +44,7 @@ extension Driver { */ // @warn_unused_result(message:"http://git.io/rxs.uo") public static func combineLatest<<%= (Array(1...i).map { "O\($0): DriverConvertibleType" }).joined(separator: ", ") %>> - (<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>, resultSelector: (<%= (Array(1...i).map { "O\($0).E" }).joined(separator: ", ") %>) throws -> E) + (<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>, resultSelector: @escaping (<%= (Array(1...i).map { "O\($0).E" }).joined(separator: ", ") %>) throws -> E) -> Driver { let source = Observable.combineLatest( <%= (Array(1...i).map { "source\($0).asDriver().asObservable()" }).joined(separator: ", ") %>, diff --git a/RxCocoa/Common/CocoaUnits/Driver/Driver+Subscription.swift b/RxCocoa/Common/CocoaUnits/Driver/Driver+Subscription.swift index 3539dc2a..4d1a4661 100644 --- a/RxCocoa/Common/CocoaUnits/Driver/Driver+Subscription.swift +++ b/RxCocoa/Common/CocoaUnits/Driver/Driver+Subscription.swift @@ -106,7 +106,7 @@ extension DriverConvertibleType { */ // @warn_unused_result(message:"http://git.io/rxs.ud") @available(*, deprecated, renamed: "drive(onNext:)") - public func driveNext(_ onNext: (E) -> Void) -> Disposable { + public func driveNext(_ onNext: @escaping (E) -> Void) -> Disposable { MainScheduler.ensureExecutingOnScheduler(errorMessage: driverErrorMessage) return self.asObservable().subscribe(onNext: onNext) } diff --git a/RxCocoa/Common/CocoaUnits/Driver/ObservableConvertibleType+Driver.swift b/RxCocoa/Common/CocoaUnits/Driver/ObservableConvertibleType+Driver.swift index 72897403..cb38166c 100644 --- a/RxCocoa/Common/CocoaUnits/Driver/ObservableConvertibleType+Driver.swift +++ b/RxCocoa/Common/CocoaUnits/Driver/ObservableConvertibleType+Driver.swift @@ -51,12 +51,12 @@ extension ObservableConvertibleType { - returns: Driving observable sequence. */ // @warn_unused_result(message:"http://git.io/rxs.uo") - public func asDriver(onErrorRecover: (_ error: Swift.Error) -> Driver) -> Driver { + public func asDriver(onErrorRecover: @escaping (_ error: Swift.Error) -> Driver) -> Driver { let source = self .asObservable() .observeOn(driverObserveOnScheduler) .catchError { error in - onErrorRecover(error: error).asObservable() + onErrorRecover(error).asObservable() } return Driver(source) } diff --git a/RxCocoa/Common/CocoaUnits/UIBindingObserver.swift b/RxCocoa/Common/CocoaUnits/UIBindingObserver.swift index 90f4d02e..92b45734 100644 --- a/RxCocoa/Common/CocoaUnits/UIBindingObserver.swift +++ b/RxCocoa/Common/CocoaUnits/UIBindingObserver.swift @@ -28,7 +28,7 @@ open class UIBindingObserver : ObserverType where UIElemen /** Initializes `ViewBindingObserver` using */ - public init(UIElement: UIElementType, binding: (UIElementType, Value) -> Void) { + public init(UIElement: UIElementType, binding: @escaping (UIElementType, Value) -> Void) { self.UIElement = UIElement self.binding = binding } diff --git a/RxCocoa/Common/DelegateProxy.swift b/RxCocoa/Common/DelegateProxy.swift index 155b548d..90df1bc1 100644 --- a/RxCocoa/Common/DelegateProxy.swift +++ b/RxCocoa/Common/DelegateProxy.swift @@ -108,8 +108,8 @@ open class DelegateProxy : _RXDelegateProxy { // proxy - open override func interceptedSelector(_ selector: Selector, withArguments arguments: [AnyObject]!) { - subjectsForSelector[selector]?.on(.next(arguments)) + open override func interceptedSelector(_ selector: Selector, withArguments arguments: [Any]) { + subjectsForSelector[selector]?.on(.next(arguments as [AnyObject])) } /** @@ -137,8 +137,8 @@ open class DelegateProxy : _RXDelegateProxy { - returns: Assigned delegate proxy or `nil` if no delegate proxy is assigned. */ open class func assignedProxyFor(_ object: AnyObject) -> AnyObject? { - let maybeDelegate: AnyObject? = objc_getAssociatedObject(object, self.delegateAssociatedObjectTag()) - return castOptionalOrFatalError(maybeDelegate) + let maybeDelegate = objc_getAssociatedObject(object, self.delegateAssociatedObjectTag()) + return castOptionalOrFatalError(maybeDelegate.map { $0 as AnyObject }) } /** diff --git a/RxCocoa/Common/Observable+Bind.swift b/RxCocoa/Common/Observable+Bind.swift index c58f4733..d43594e1 100644 --- a/RxCocoa/Common/Observable+Bind.swift +++ b/RxCocoa/Common/Observable+Bind.swift @@ -94,7 +94,7 @@ extension ObservableType { - returns: Subscription object used to unsubscribe from the observable sequence. */ // @warn_unused_result(message: "http://git.io/rxs.ud") - public func bindNext(_ onNext: (E) -> Void) -> Disposable { + public func bindNext(_ onNext: @escaping (E) -> Void) -> Disposable { return subscribe(onNext: onNext, onError: { error in let error = "Binding error: \(error)" #if DEBUG diff --git a/RxCocoa/Common/Observables/Implementations/KVOObserver.swift b/RxCocoa/Common/Observables/Implementations/KVOObserver.swift index bba11708..b079aa15 100644 --- a/RxCocoa/Common/Observables/Implementations/KVOObserver.swift +++ b/RxCocoa/Common/Observables/Implementations/KVOObserver.swift @@ -20,7 +20,7 @@ protocol KVOObservableProtocol { class KVOObserver : _RXKVOObserver , Disposable { - typealias Callback = @escaping (AnyObject?) -> Void + typealias Callback = @escaping (Any?) -> Void var retainSelf: KVOObserver? = nil diff --git a/RxCocoa/Common/Observables/Implementations/MessageSentObserver.swift b/RxCocoa/Common/Observables/Implementations/MessageSentObserver.swift index ebee8916..325bf610 100644 --- a/RxCocoa/Common/Observables/Implementations/MessageSentObserver.swift +++ b/RxCocoa/Common/Observables/Implementations/MessageSentObserver.swift @@ -29,7 +29,7 @@ import Foundation init() { } - @objc func messageSent(withParameters parameters: [AnyObject]) -> Void { + @objc func messageSent(withParameters parameters: [Any]) -> Void { _subject.on(.next()) } @@ -58,8 +58,8 @@ import Foundation init() { } - @objc func messageSent(withParameters parameters: [AnyObject]) -> Void { - _subject.on(.next(parameters)) + @objc func messageSent(withParameters parameters: [Any]) -> Void { + _subject.on(.next(parameters as [AnyObject])) } func asObservable() -> Observable<[AnyObject]> { diff --git a/RxCocoa/Common/Observables/NSURLSession+Rx.swift b/RxCocoa/Common/Observables/NSURLSession+Rx.swift index 35eb6f2a..31bc7265 100644 --- a/RxCocoa/Common/Observables/NSURLSession+Rx.swift +++ b/RxCocoa/Common/Observables/NSURLSession+Rx.swift @@ -69,8 +69,8 @@ func convertURLRequestToCurlCommand(_ request: URLRequest) -> String { } for (key, value) in request.allHTTPHeaderFields ?? [:] { - let escapedKey = escapeTerminalString((key as String) ?? "") - let escapedValue = escapeTerminalString((value as String) ?? "") + let escapedKey = escapeTerminalString(key as String) + let escapedValue = escapeTerminalString(value as String) returnValue += "\n -H \"\(escapedKey): \(escapedValue)\" " } @@ -134,7 +134,7 @@ extension URLSession { if Logging.URLRequests(request) { let interval = Date().timeIntervalSince(d ?? Date()) print(convertURLRequestToCurlCommand(request)) - print(convertResponseToString(data, response, error, interval)) + print(convertResponseToString(data, response, error as NSError!, interval)) } guard let response = response, let data = data else { @@ -207,7 +207,7 @@ extension URLSession { public func rx_JSON(_ request: URLRequest) -> Observable { return rx_data(request).map { (data) -> AnyObject in do { - return try JSONSerialization.jsonObject(with: data, options: []) + return try JSONSerialization.jsonObject(with: data, options: []) as AnyObject } catch let error { throw RxCocoaURLError.deserializationError(error: error) } diff --git a/RxCocoa/Common/_RXDelegateProxy.h b/RxCocoa/Common/_RXDelegateProxy.h index 63876d2f..03b93bd8 100644 --- a/RxCocoa/Common/_RXDelegateProxy.h +++ b/RxCocoa/Common/_RXDelegateProxy.h @@ -8,6 +8,8 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface _RXDelegateProxy : NSObject @property (nonatomic, weak, readonly) id _forwardToDelegate; @@ -19,3 +21,5 @@ -(void)interceptedSelector:(SEL)selector withArguments:(NSArray*)arguments; @end + +NS_ASSUME_NONNULL_END diff --git a/RxCocoa/iOS/UIBarButtonItem+Rx.swift b/RxCocoa/iOS/UIBarButtonItem+Rx.swift index 3b931c18..49123cd9 100644 --- a/RxCocoa/iOS/UIBarButtonItem+Rx.swift +++ b/RxCocoa/iOS/UIBarButtonItem+Rx.swift @@ -57,7 +57,7 @@ class BarButtonItemTarget: RxTarget { weak var barButtonItem: UIBarButtonItem? var callback: Callback! - init(barButtonItem: UIBarButtonItem, callback: () -> Void) { + init(barButtonItem: UIBarButtonItem, callback: @escaping () -> Void) { self.barButtonItem = barButtonItem self.callback = callback super.init() diff --git a/RxCocoa/iOS/UICollectionView+Rx.swift b/RxCocoa/iOS/UICollectionView+Rx.swift index e1d9eb50..36bf5d4e 100644 --- a/RxCocoa/iOS/UICollectionView+Rx.swift +++ b/RxCocoa/iOS/UICollectionView+Rx.swift @@ -45,11 +45,11 @@ extension UICollectionView { @available(*, deprecated, renamed: "rx_items(source:cellFactory:)") public func rx_itemsWithCellFactory (_ source: O) - -> (_ cellFactory: (UICollectionView, Int, S.Iterator.Element) -> UICollectionViewCell) + -> (_ cellFactory: @escaping (UICollectionView, Int, S.Iterator.Element) -> UICollectionViewCell) -> Disposable where O.E == S { return { cellFactory in let dataSource = RxCollectionViewReactiveArrayDataSourceSequenceWrapper(cellFactory: cellFactory) - return self.rx_itemsWithDataSource(dataSource)(source: source) + return self.rx_itemsWithDataSource(dataSource)(source) } } @@ -80,11 +80,11 @@ extension UICollectionView { */ public func rx_items (source: O) - -> (_ cellFactory: (UICollectionView, Int, S.Iterator.Element) -> UICollectionViewCell) + -> (_ cellFactory: @escaping (UICollectionView, Int, S.Iterator.Element) -> UICollectionViewCell) -> Disposable where O.E == S { return { cellFactory in let dataSource = RxCollectionViewReactiveArrayDataSourceSequenceWrapper(cellFactory: cellFactory) - return self.rx_items(dataSource: dataSource)(source: source) + return self.rx_items(dataSource: dataSource)(source) } } @@ -116,7 +116,7 @@ extension UICollectionView { public func rx_itemsWithCellIdentifier (_ cellIdentifier: String, cellType: Cell.Type = Cell.self) -> (_ source: O) - -> (_ configureCell: (Int, S.Iterator.Element, Cell) -> Void) + -> (_ configureCell: @escaping (Int, S.Iterator.Element, Cell) -> Void) -> Disposable where O.E == S { return { source in return { configureCell in @@ -127,7 +127,7 @@ extension UICollectionView { return cell } - return self.rx_itemsWithDataSource(dataSource)(source: source) + return self.rx_itemsWithDataSource(dataSource)(source) } } } @@ -158,7 +158,7 @@ extension UICollectionView { public func rx_items (cellIdentifier: String, cellType: Cell.Type = Cell.self) -> (_ source: O) - -> (_ configureCell: (Int, S.Iterator.Element, Cell) -> Void) + -> (_ configureCell: @escaping (Int, S.Iterator.Element, Cell) -> Void) -> Disposable where O.E == S { return { source in return { configureCell in @@ -169,7 +169,7 @@ extension UICollectionView { return cell } - return self.rx_items(dataSource: dataSource)(source: source) + return self.rx_items(dataSource: dataSource)(source) } } } diff --git a/RxCocoa/iOS/UIControl+Rx.swift b/RxCocoa/iOS/UIControl+Rx.swift index cfc16c9a..8a58049c 100644 --- a/RxCocoa/iOS/UIControl+Rx.swift +++ b/RxCocoa/iOS/UIControl+Rx.swift @@ -63,7 +63,7 @@ extension UIControl { You might be wondering why the ugly `as!` casts etc, well, for some reason if Swift compiler knows C is UIControl type and optimizations are turned on, it will crash. */ - static func rx_value(_ control: C, getter: @escaping (C) -> T, setter: (C, T) -> Void) -> ControlProperty { + static func rx_value(_ control: C, getter: @escaping (C) -> T, setter: @escaping (C, T) -> Void) -> ControlProperty { let source: Observable = Observable.create { [weak weakControl = control] observer in guard let control = weakControl else { observer.on(.completed)