Created
January 1, 2018 23:15
-
-
Save twittemb/7d1df28d1fb376abb21ed0d9e011078c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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