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.

32 lines
1.0 KiB

5 years ago
5 years ago
5 years ago
  1. //
  2. // mergeWith.swift
  3. // RxSwiftExt
  4. //
  5. // Created by Joan Disho on 12/05/18.
  6. // Copyright © 2018 RxSwift Community. All rights reserved.
  7. //
  8. import Foundation
  9. import RxSwift
  10. extension Observable {
  11. /**
  12. Merges elements from the observable sequence with those of a different observable sequence into a single observable sequence.
  13. - parameter with: Other observable.
  14. - returns: The observable sequence that merges the elements of the observable sequences.
  15. */
  16. public func merge(with other: Observable<Element>) -> Observable<Element> {
  17. return Observable.merge(self, other)
  18. }
  19. /**
  20. Merges elements from the observable sequence with those of a different observable sequences into a single observable sequence.
  21. - parameter with: Other observables.
  22. - returns: The observable sequence that merges the elements of the observable sequences.
  23. */
  24. public func merge(with others: [Observable<Element>]) -> Observable<Element> {
  25. return Observable.merge([self] + others)
  26. }
  27. }