Skip to content

Instantly share code, notes, and snippets.

@andreaslydemann
Created January 29, 2019 06:38
Show Gist options
  • Select an option

  • Save andreaslydemann/65a191a7d1e42c0ea6b0bf5bd4822f02 to your computer and use it in GitHub Desktop.

Select an option

Save andreaslydemann/65a191a7d1e42c0ea6b0bf5bd4822f02 to your computer and use it in GitHub Desktop.
import RxSwift
let disposeBag = DisposeBag()
let xmenMovies = Observable.of("First Class", "Days of Future Past", "Apocalypse")
let imdbRatings = Observable.of(7.7, 8.0, 7.0)
Observable.zip(xmenMovies, imdbRatings) { movie, rating in
"\(movie) - \(rating)"
}
.subscribe(onNext: {
print($0)
})
.disposed(by: disposeBag)
// Output:
// First Class - 7.7
// Days of Future Past - 8.0
// Apocalypse - 7.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment