Skip to content

Instantly share code, notes, and snippets.

@anuragajwani
Last active May 7, 2017 20:30
Show Gist options
  • Save anuragajwani/4c055a98f86379e9962fe0f8930e4ea9 to your computer and use it in GitHub Desktop.
Save anuragajwani/4c055a98f86379e9962fe0f8930e4ea9 to your computer and use it in GitHub Desktop.
private func convert(movies: [Movie]) -> MoviesViewModel {
let movieCellViewModels = movies.map { movie in
MovieCellViewModel(
textLabel: "\(movie.title) (\(movie.year))",
detailTextLabel: movie.genre.joined(separator: ", ")
)
}
return MoviesViewModel(movies: movieCellViewModels)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment