Created
May 6, 2017 19:16
-
-
Save anuragajwani/aa0edafcd77f5e9980806590e3026eac to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Foundation | |
import UIKit | |
final class MoviesTableViewDataSource: NSObject, UITableViewDataSource { | |
var viewModels: [MovieCellViewModel] = [] | |
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return self.viewModels.count | |
} | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
let cellViewModel = viewModels[indexPath.row] | |
let cell = tableView.dequeueReusableCell(withIdentifier: "MovieCell")! | |
cell.textLabel?.text = cellViewModel.textLabel | |
cell.detailTextLabel?.text = cellViewModel.detailTextLabel | |
return cell | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment