You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1.1 KiB

5 years ago
5 years ago
  1. //
  2. // zipWith.swift
  3. // RxSwiftExt
  4. //
  5. // Created by Arjan Duijzer on 26/12/2017.
  6. // Copyright © 2017 RxSwift Community. All rights reserved.
  7. //
  8. import RxSwift
  9. extension ObservableConvertibleType {
  10. /**
  11. Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
  12. - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)
  13. - Parameters:
  14. - with: A second Observable<T> to zip with `self`
  15. - resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.
  16. - Returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
  17. */
  18. public func zip<Other: ObservableConvertibleType, ResultType>(with second: Other, resultSelector: @escaping (Element, Other.Element) throws -> ResultType) -> Observable<ResultType> {
  19. return Observable.zip(asObservable(), second.asObservable(), resultSelector: resultSelector)
  20. }
  21. }