WIP: Marks escaping closures as such.

This commit is contained in:
Mo Ramezanpoor 2016-08-16 14:25:15 +01:00
parent c12b315149
commit 2d36297601
24 changed files with 72 additions and 72 deletions

View File

@ -12,7 +12,7 @@ struct PriorityQueue<Element: AnyObject> {
private let _hasHigherPriority: (Element, Element) -> Bool
fileprivate var _elements = [Element]()
init(hasHigherPriority: (Element, Element) -> Bool) {
init(hasHigherPriority: @escaping (Element, Element) -> Bool) {
_hasHigherPriority = hasHigherPriority
}

View File

@ -19,7 +19,7 @@ public protocol ImmediateSchedulerType {
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
func schedule<StateType>(_ state: StateType, action: (StateType) -> Disposable) -> Disposable
func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable
}
extension ImmediateSchedulerType {
@ -30,7 +30,7 @@ extension ImmediateSchedulerType {
- parameter action: Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
public func scheduleRecursive<State>(_ state: State, action: (_ state: State, _ recurse: (State) -> ()) -> ()) -> Disposable {
public func scheduleRecursive<State>(_ state: State, action: @escaping (_ state: State, _ recurse: (State) -> ()) -> ()) -> Disposable {
let recursiveScheduler = RecursiveImmediateScheduler(action: action, scheduler: self)
recursiveScheduler.schedule(state)

View File

@ -45,7 +45,7 @@ open class Observable<Element> : ObservableType {
/**
Optimizations for map operator
*/
internal func composeMap<R>(_ selector: (Element) throws -> R) -> Observable<R> {
internal func composeMap<R>(_ selector: @escaping (Element) throws -> R) -> Observable<R> {
return Map(source: self, selector: selector)
}
}

View File

@ -24,7 +24,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func combineLatest<O1: ObservableType, O2: ObservableType>
(_ source1: O1, _ source2: O2, resultSelector: (O1.E, O2.E) throws -> E)
(_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.E, O2.E) throws -> E)
-> Observable<E> {
return CombineLatest2(
source1: source1.asObservable(), source2: source2.asObservable(),
@ -105,7 +105,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType>
(_ 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)
-> Observable<E> {
return CombineLatest3(
source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(),
@ -193,7 +193,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>
(_ 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)
-> Observable<E> {
return CombineLatest4(
source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(),
@ -288,7 +288,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>
(_ 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)
-> Observable<E> {
return CombineLatest5(
source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(),
@ -390,7 +390,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>
(_ 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)
-> Observable<E> {
return CombineLatest6(
source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(),
@ -499,7 +499,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>
(_ 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)
-> Observable<E> {
return CombineLatest7(
source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(),
@ -615,7 +615,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>
(_ 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)
-> Observable<E> {
return CombineLatest8(
source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), source8: source8.asObservable(),

View File

@ -23,7 +23,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func combineLatest<<%= (Array(1...i).map { "O\($0): ObservableType" }).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)
-> Observable<E> {
return CombineLatest<%= i %>(
<%= (Array(1...i).map { "source\($0): source\($0).asObservable()" }).joined(separator: ", ") %>,

View File

@ -13,7 +13,7 @@ class DeferredSink<S: ObservableType, O: ObserverType> : Sink<O>, ObserverType w
private let _observableFactory: () throws -> S
init(observableFactory: () throws -> S, observer: O) {
init(observableFactory: @escaping () throws -> S, observer: O) {
_observableFactory = observableFactory
super.init(observer: observer)
}

View File

@ -54,7 +54,7 @@ class Generate<S, E> : Producer<E> {
fileprivate let _resultSelector: (S) throws -> E
fileprivate let _scheduler: ImmediateSchedulerType
init(initialState: S, condition: (S) throws -> Bool, iterate: (S) throws -> S, resultSelector: (S) throws -> E, scheduler: ImmediateSchedulerType) {
init(initialState: S, condition: @escaping (S) throws -> Bool, iterate: @escaping (S) throws -> S, resultSelector: @escaping (S) throws -> E, scheduler: ImmediateSchedulerType) {
_initialState = initialState
_condition = condition
_iterate = iterate

View File

@ -64,7 +64,7 @@ class RefCountSink<CO: ConnectableObservableType, O: ObserverType>
}
class RefCount<CO: ConnectableObservableType>: Producer<CO.E> {
private let _lock = NSRecursiveLock()
fileprivate let _lock = NSRecursiveLock()
// state
fileprivate var _count = 0

View File

@ -137,7 +137,7 @@ class RetryWhenSequence<S: Sequence, TriggerObservable: ObservableType, Error> :
fileprivate let _sources: S
fileprivate let _notificationHandler: (Observable<Error>) -> TriggerObservable
init(sources: S, notificationHandler: (Observable<Error>) -> TriggerObservable) {
init(sources: S, notificationHandler: @escaping (Observable<Error>) -> TriggerObservable) {
_sources = sources
_notificationHandler = notificationHandler
}

View File

@ -24,7 +24,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func zip<O1: ObservableType, O2: ObservableType>
(_ source1: O1, _ source2: O2, resultSelector: (O1.E, O2.E) throws -> E)
(_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.E, O2.E) throws -> E)
-> Observable<E> {
return Zip2(
source1: source1.asObservable(), source2: source2.asObservable(),
@ -117,7 +117,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType>
(_ 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)
-> Observable<E> {
return Zip3(
source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(),
@ -218,7 +218,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>
(_ 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)
-> Observable<E> {
return Zip4(
source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(),
@ -327,7 +327,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>
(_ 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)
-> Observable<E> {
return Zip5(
source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(),
@ -444,7 +444,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>
(_ 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)
-> Observable<E> {
return Zip6(
source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(),
@ -569,7 +569,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>
(_ 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)
-> Observable<E> {
return Zip7(
source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(),
@ -702,7 +702,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>
(_ 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)
-> Observable<E> {
return Zip8(
source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), source8: source8.asObservable(),

View File

@ -23,7 +23,7 @@ extension Observable {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func zip<<%= (Array(1...i).map { "O\($0): ObservableType" }).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)
-> Observable<E> {
return Zip<%= i %>(
<%= (Array(1...i).map { "source\($0): source\($0).asObservable()" }).joined(separator: ", ") %>,

View File

@ -25,7 +25,7 @@ extension ObservableType {
- returns: An observable sequence containing a single element with the final accumulator value.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func reduce<A, R>(_ seed: A, accumulator: (A, E) throws -> A, mapResult: (A) throws -> R)
public func reduce<A, R>(_ seed: A, accumulator: @escaping (A, E) throws -> A, mapResult: @escaping (A) throws -> R)
-> Observable<R> {
return Reduce(source: self.asObservable(), seed: seed, accumulator: accumulator, mapResult: mapResult)
}
@ -42,7 +42,7 @@ extension ObservableType {
- returns: An observable sequence containing a single element with the final accumulator value.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func reduce<A>(_ seed: A, accumulator: (A, E) throws -> A)
public func reduce<A>(_ seed: A, accumulator: @escaping (A, E) throws -> A)
-> Observable<A> {
return Reduce(source: self.asObservable(), seed: seed, accumulator: accumulator, mapResult: { $0 })
}

View File

@ -44,7 +44,7 @@ extension ObservableType {
- returns: An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func multicast<S: SubjectType, R>(_ subjectSelector: () throws -> S, selector: (Observable<S.E>) throws -> Observable<R>)
public func multicast<S: SubjectType, R>(_ subjectSelector: @escaping () throws -> S, selector: @escaping (Observable<S.E>) throws -> Observable<R>)
-> Observable<R> where S.SubjectObserverType.E == E {
return Multicast(
source: self.asObservable(),

View File

@ -132,7 +132,7 @@ extension Observable {
- returns: The generated sequence.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public static func generate(initialState: E, condition: (E) throws -> Bool, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance, iterate: (E) throws -> E) -> Observable<E> {
public static func generate(initialState: E, condition: @escaping (E) throws -> Bool, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance, iterate: @escaping (E) throws -> E) -> Observable<E> {
return Generate(initialState: initialState, condition: condition, iterate: iterate, resultSelector: { $0 }, scheduler: scheduler)
}

View File

@ -21,7 +21,7 @@ extension Collection where Iterator.Element : ObservableType {
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func combineLatest<R>(_ resultSelector: ([Generator.Element.E]) throws -> R) -> Observable<R> {
public func combineLatest<R>(_ resultSelector: @escaping ([Generator.Element.E]) throws -> R) -> Observable<R> {
return CombineLatestCollectionType(sources: self, resultSelector: resultSelector)
}
}
@ -39,7 +39,7 @@ extension Collection where Iterator.Element : ObservableType {
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func zip<R>(_ resultSelector: ([Generator.Element.E]) throws -> R) -> Observable<R> {
public func zip<R>(_ resultSelector: @escaping ([Generator.Element.E]) throws -> R) -> Observable<R> {
return ZipCollectionType(sources: self, resultSelector: resultSelector)
}
}
@ -187,7 +187,7 @@ extension ObservableType {
- returns: An observable sequence containing the source sequence's elements, followed by the elements produced by the handler's resulting observable sequence in case an error occurred.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func catchError(_ handler: (Swift.Error) throws -> Observable<E>)
public func catchError(_ handler: @escaping (Swift.Error) throws -> Observable<E>)
-> Observable<E> {
return Catch(source: asObservable(), handler: handler)
}
@ -312,7 +312,7 @@ extension ObservableType {
- parameter resultSelector: Function to invoke for each element from the self combined with the latest element from the second source, if any.
- returns: An observable sequence containing the result of combining each element of the self with the latest element from the second source, if any, using the specified result selector function.
*/
public func withLatestFrom<SecondO: ObservableConvertibleType, ResultType>(_ second: SecondO, resultSelector: (E, SecondO.E) throws -> ResultType) -> Observable<ResultType> {
public func withLatestFrom<SecondO: ObservableConvertibleType, ResultType>(_ second: SecondO, resultSelector: @escaping (E, SecondO.E) throws -> ResultType) -> Observable<ResultType> {
return WithLatestFrom(first: asObservable(), second: second.asObservable(), resultSelector: resultSelector)
}

View File

@ -36,7 +36,7 @@ extension ObservableType {
- returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func distinctUntilChanged<K: Equatable>(_ keySelector: (E) throws -> K)
public func distinctUntilChanged<K: Equatable>(_ keySelector: @escaping (E) throws -> K)
-> Observable<E> {
return self.distinctUntilChanged(keySelector, comparer: { $0 == $1 })
}
@ -50,7 +50,7 @@ extension ObservableType {
- returns: An observable sequence only containing the distinct contiguous elements, based on `comparer`, from the source sequence.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func distinctUntilChanged(_ comparer: (E, E) throws -> Bool)
public func distinctUntilChanged(_ comparer: @escaping (E, E) throws -> Bool)
-> Observable<E> {
return self.distinctUntilChanged({ $0 }, comparer: comparer)
}
@ -65,7 +65,7 @@ extension ObservableType {
- returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value and the comparer, from the source sequence.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func distinctUntilChanged<K>(_ keySelector: (E) throws -> K, comparer: (K, K) throws -> Bool)
public func distinctUntilChanged<K>(_ keySelector: @escaping (E) throws -> K, comparer: @escaping (K, K) throws -> Bool)
-> Observable<E> {
return DistinctUntilChanged(source: self.asObservable(), selector: keySelector, comparer: comparer)
}
@ -85,7 +85,7 @@ extension ObservableType {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
@available(*, deprecated, renamed: "do(onNext:onError:onCompleted:)")
public func doOn(_ eventHandler: (Event<E>) throws -> Void)
public func doOn(_ eventHandler: @escaping (Event<E>) throws -> Void)
-> Observable<E> {
return Do(source: self.asObservable(), eventHandler: eventHandler, onSubscribe: nil, onDispose: nil)
}
@ -128,7 +128,7 @@ extension ObservableType {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
@available(*, deprecated, renamed: "do(onNext:)")
public func doOnNext(onNext: ((E) throws -> Void))
public func doOnNext(onNext: @escaping (E) throws -> Void)
-> Observable<E> {
return self.do(onNext: onNext)
}
@ -141,7 +141,7 @@ extension ObservableType {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
@available(*, deprecated, renamed: "do(onError:)")
public func doOnError(onError: ((Swift.Error) throws -> Void))
public func doOnError(onError: @escaping (Swift.Error) throws -> Void)
-> Observable<E> {
return self.do(onError: onError)
}
@ -154,7 +154,7 @@ extension ObservableType {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
@available(*, deprecated, renamed: "do(onCompleted:)")
public func doOnCompleted(onCompleted: (() throws -> Void))
public func doOnCompleted(onCompleted: @escaping () throws -> Void)
-> Observable<E> {
return self.do(onCompleted: onCompleted)
}
@ -250,7 +250,7 @@ extension ObservableType {
- returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func retryWhen<TriggerObservable: ObservableType, Error: Swift.Error>(_ notificationHandler: (Observable<Error>) -> TriggerObservable)
public func retryWhen<TriggerObservable: ObservableType, Error: Swift.Error>(_ notificationHandler: @escaping (Observable<Error>) -> TriggerObservable)
-> Observable<E> {
return RetryWhenSequence(sources: InfiniteSequence(repeatedValue: self.asObservable()), notificationHandler: notificationHandler)
}
@ -265,7 +265,7 @@ extension ObservableType {
- returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func retryWhen<TriggerObservable: ObservableType>(_ notificationHandler: (Observable<Swift.Error>) -> TriggerObservable)
public func retryWhen<TriggerObservable: ObservableType>(_ notificationHandler: @escaping (Observable<Swift.Error>) -> TriggerObservable)
-> Observable<E> {
return RetryWhenSequence(sources: InfiniteSequence(repeatedValue: self.asObservable()), notificationHandler: notificationHandler)
}
@ -287,7 +287,7 @@ extension ObservableType {
- returns: An observable sequence containing the accumulated values.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func scan<A>(_ seed: A, accumulator: (A, E) throws -> A)
public func scan<A>(_ seed: A, accumulator: @escaping (A, E) throws -> A)
-> Observable<A> {
return Scan(source: self.asObservable(), seed: seed, accumulator: accumulator)
}

View File

@ -21,7 +21,7 @@ extension ObservableType {
- returns: An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func filter(_ predicate: (E) throws -> Bool)
public func filter(_ predicate: @escaping (E) throws -> Bool)
-> Observable<E> {
return Filter(source: asObservable(), predicate: predicate)
}
@ -40,7 +40,7 @@ extension ObservableType {
- returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func takeWhile(_ predicate: (E) throws -> Bool)
public func takeWhile(_ predicate: @escaping (E) throws -> Bool)
-> Observable<E> {
return TakeWhile(source: asObservable(), predicate: predicate)
}
@ -56,7 +56,7 @@ extension ObservableType {
- returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func takeWhileWithIndex(_ predicate: (E, Int) throws -> Bool)
public func takeWhileWithIndex(_ predicate: @escaping (E, Int) throws -> Bool)
-> Observable<E> {
return TakeWhile(source: asObservable(), predicate: predicate)
}
@ -140,7 +140,7 @@ extension ObservableType {
- returns: An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func skipWhile(_ predicate: (E) throws -> Bool) -> Observable<E> {
public func skipWhile(_ predicate: @escaping (E) throws -> Bool) -> Observable<E> {
return SkipWhile(source: asObservable(), predicate: predicate)
}
@ -154,7 +154,7 @@ extension ObservableType {
- returns: An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func skipWhileWithIndex(_ predicate: (E, Int) throws -> Bool) -> Observable<E> {
public func skipWhileWithIndex(_ predicate: @escaping (E, Int) throws -> Bool) -> Observable<E> {
return SkipWhile(source: asObservable(), predicate: predicate)
}
}
@ -173,7 +173,7 @@ extension ObservableType {
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func map<R>(_ selector: (E) throws -> R)
public func map<R>(_ selector: @escaping (E) throws -> R)
-> Observable<R> {
return self.asObservable().composeMap(selector)
}
@ -187,7 +187,7 @@ extension ObservableType {
- returns: An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func mapWithIndex<R>(_ selector: (E, Int) throws -> R)
public func mapWithIndex<R>(_ selector: @escaping (E, Int) throws -> R)
-> Observable<R> {
return MapWithIndex(source: asObservable(), selector: selector)
}
@ -206,7 +206,7 @@ extension ObservableType {
- returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func flatMap<O: ObservableConvertibleType>(_ selector: (E) throws -> O)
public func flatMap<O: ObservableConvertibleType>(_ selector: @escaping (E) throws -> O)
-> Observable<O.E> {
return FlatMap(source: asObservable(), selector: selector)
}
@ -220,7 +220,7 @@ extension ObservableType {
- returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func flatMapWithIndex<O: ObservableConvertibleType>(_ selector: (E, Int) throws -> O)
public func flatMapWithIndex<O: ObservableConvertibleType>(_ selector: @escaping (E, Int) throws -> O)
-> Observable<O.E> {
return FlatMapWithIndex(source: asObservable(), selector: selector)
}
@ -240,7 +240,7 @@ extension ObservableType {
- returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence that was received while no other sequence was being calculated.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func flatMapFirst<O: ObservableConvertibleType>(_ selector: (E) throws -> O)
public func flatMapFirst<O: ObservableConvertibleType>(_ selector: @escaping (E) throws -> O)
-> Observable<O.E> {
return FlatMapFirst(source: asObservable(), selector: selector)
}
@ -262,7 +262,7 @@ extension ObservableType {
Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func flatMapLatest<O: ObservableConvertibleType>(_ selector: (E) throws -> O)
public func flatMapLatest<O: ObservableConvertibleType>(_ selector: @escaping (E) throws -> O)
-> Observable<O.E> {
return FlatMapLatest(source: asObservable(), selector: selector)
}
@ -315,7 +315,7 @@ extension ObservableType {
- returns: An observable sequence that emits a single item or throws an exception if more (or none) of them are emitted.
*/
// @warn_unused_result(message:"http://git.io/rxs.uo")
public func single(_ predicate: (E) throws -> Bool)
public func single(_ predicate: @escaping (E) throws -> Bool)
-> Observable<E> {
return SingleAsync(source: asObservable(), predicate: predicate)
}

View File

@ -38,7 +38,7 @@ public protocol SchedulerType: ImmediateSchedulerType {
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: (StateType) -> Disposable) -> Disposable
func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable
/**
Schedules a periodic piece of work.
@ -49,7 +49,7 @@ public protocol SchedulerType: ImmediateSchedulerType {
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: (StateType) -> StateType) -> Disposable
func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable
}
extension SchedulerType {
@ -62,13 +62,13 @@ extension SchedulerType {
- parameter period: Period for running the work periodically.
- returns: The disposable object used to cancel the scheduled recurring action (best effort).
*/
public func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: (StateType) -> StateType) -> Disposable {
public func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable {
let schedule = SchedulePeriodicRecursive(scheduler: self, startAfter: startAfter, period: period, action: action, state: state)
return schedule.start()
}
func scheduleRecursive<State>(_ state: State, dueTime: RxTimeInterval, action: (State, AnyRecursiveScheduler<State>) -> ()) -> Disposable {
func scheduleRecursive<State>(_ state: State, dueTime: RxTimeInterval, action: @escaping (State, AnyRecursiveScheduler<State>) -> ()) -> Disposable {
let scheduler = AnyRecursiveScheduler(scheduler: self, action: action)
scheduler.schedule(state, dueTime: dueTime)

View File

@ -56,7 +56,7 @@ open class ConcurrentDispatchQueueScheduler: SchedulerType {
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
public final func schedule<StateType>(_ state: StateType, action: (StateType) -> Disposable) -> Disposable {
public final func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {
return self.configuration.schedule(state, action: action)
}
@ -68,7 +68,7 @@ open class ConcurrentDispatchQueueScheduler: SchedulerType {
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
public final func scheduleRelative<StateType>(_ state: StateType, dueTime: Foundation.TimeInterval, action: (StateType) -> Disposable) -> Disposable {
public final func scheduleRelative<StateType>(_ state: StateType, dueTime: Foundation.TimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable {
return self.configuration.scheduleRelative(state, dueTime: dueTime, action: action)
}
@ -81,7 +81,7 @@ open class ConcurrentDispatchQueueScheduler: SchedulerType {
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
open func schedulePeriodic<StateType>(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: (StateType) -> StateType) -> Disposable {
open func schedulePeriodic<StateType>(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: @escaping (StateType) -> StateType) -> Disposable {
return self.configuration.schedulePeriodic(state, startAfter: startAfter, period: period, action: action)
}
}

View File

@ -71,7 +71,7 @@ public final class ConcurrentMainScheduler : SchedulerType {
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
public final func scheduleRelative<StateType>(_ state: StateType, dueTime: Foundation.TimeInterval, action: (StateType) -> Disposable) -> Disposable {
public final func scheduleRelative<StateType>(_ state: StateType, dueTime: Foundation.TimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable {
return _mainScheduler.scheduleRelative(state, dueTime: dueTime, action: action)
}
@ -84,7 +84,7 @@ public final class ConcurrentMainScheduler : SchedulerType {
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
public func schedulePeriodic<StateType>(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: (StateType) -> StateType) -> Disposable {
public func schedulePeriodic<StateType>(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: @escaping (StateType) -> StateType) -> Disposable {
return _mainScheduler.schedulePeriodic(state, startAfter: startAfter, period: period, action: action)
}
}

View File

@ -104,7 +104,7 @@ open class CurrentThreadScheduler : ImmediateSchedulerType {
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
open func schedule<StateType>(_ state: StateType, action: (StateType) -> Disposable) -> Disposable {
open func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {
if CurrentThreadScheduler.isScheduleRequired {
CurrentThreadScheduler.isScheduleRequired = false

View File

@ -25,7 +25,7 @@ private class ImmediateScheduler : ImmediateSchedulerType {
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
func schedule<StateType>(_ state: StateType, action: (StateType) -> Disposable) -> Disposable {
func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {
let disposable = SingleAssignmentDisposable()
_asyncLock.invoke(AnonymousInvocable {
if disposable.isDisposed {

View File

@ -89,11 +89,11 @@ open class SerialDispatchQueueScheduler : SchedulerType {
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
public final func schedule<StateType>(_ state: StateType, action: (StateType) -> Disposable) -> Disposable {
public final func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {
return self.scheduleInternal(state, action: action)
}
func scheduleInternal<StateType>(_ state: StateType, action: (StateType) -> Disposable) -> Disposable {
func scheduleInternal<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {
return self.configuration.schedule(state, action: action)
}
@ -105,7 +105,7 @@ open class SerialDispatchQueueScheduler : SchedulerType {
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
public final func scheduleRelative<StateType>(_ state: StateType, dueTime: Foundation.TimeInterval, action: (StateType) -> Disposable) -> Disposable {
public final func scheduleRelative<StateType>(_ state: StateType, dueTime: Foundation.TimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable {
return self.configuration.scheduleRelative(state, dueTime: dueTime, action: action)
}
@ -118,7 +118,7 @@ open class SerialDispatchQueueScheduler : SchedulerType {
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
open func schedulePeriodic<StateType>(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: (StateType) -> StateType) -> Disposable {
open func schedulePeriodic<StateType>(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: @escaping (StateType) -> StateType) -> Disposable {
return self.configuration.schedulePeriodic(state, startAfter: startAfter, period: period, action: action)
}
}

View File

@ -72,7 +72,7 @@ open class VirtualTimeScheduler<Converter: VirtualTimeConverterType>
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
open func schedule<StateType>(_ state: StateType, action: (StateType) -> Disposable) -> Disposable {
open func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {
return self.scheduleRelative(state, dueTime: 0.0) { a in
return action(a)
}
@ -86,7 +86,7 @@ open class VirtualTimeScheduler<Converter: VirtualTimeConverterType>
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
open func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: (StateType) -> Disposable) -> Disposable {
open func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable {
let time = self.now.addingTimeInterval(dueTime)
let absoluteTime = _converter.convertToVirtualTime(time)
let adjustedTime = self.adjustScheduledTime(absoluteTime)
@ -101,7 +101,7 @@ open class VirtualTimeScheduler<Converter: VirtualTimeConverterType>
- parameter action: Action to be executed.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
open func scheduleRelativeVirtual<StateType>(_ state: StateType, dueTime: VirtualTimeInterval, action: (StateType) -> Disposable) -> Disposable {
open func scheduleRelativeVirtual<StateType>(_ state: StateType, dueTime: VirtualTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable {
let time = _converter.offsetVirtualTime(self.clock, offset: dueTime)
return scheduleAbsoluteVirtual(state, time: time, action: action)
}