Skip to content

Instantly share code, notes, and snippets.

@twittemb
Created January 1, 2018 23:15
Show Gist options
  • Save twittemb/7d1df28d1fb376abb21ed0d9e011078c to your computer and use it in GitHub Desktop.
Save twittemb/7d1df28d1fb376abb21ed0d9e011078c to your computer and use it in GitHub Desktop.
import RxFlow
import RxSwift
class WatchedViewModel: Stepper {
let movies: [MovieViewModel]
init(with service: MoviesService) {
// we can do some data refactoring in order to display
// things exactly the way we want (this is the aim of a ViewModel)
self.movies = service.watchedMovies().map({ (movie) -> MovieViewModel in
return MovieViewModel(id: movie.id,
title: movie.title,
image: movie.image)
})
}
public func pick (movieId: Int) {
self.step.onNext(DemoStep.moviePicked(withMovieId: movieId))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment