Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import RxSwift
let disposeBag = DisposeBag()
let oldXmenMovies = PublishSubject<String>()
let newXmenMovies = PublishSubject<String>()
oldXmenMovies.amb(newXmenMovies)
.subscribe(onNext: {
print($0)
})
.disposed(by: disposeBag)
oldXmenMovies.onNext("X-Men")
oldXmenMovies.onNext("X-Men United")
newXmenMovies.onNext("First Class")
oldXmenMovies.onNext("The Last Stand")
newXmenMovies.onNext("Days of Future Past")
// Output:
// X-Men
// X-Men United
// The Last Stand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment