-
-
Save gfontenot/683bf0b98a03313b11d9 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
// before | |
let cell = tableView.dequeueReusableCellWithIdentifier("EmployeeCell", forIndexPath: indexPath) as EmployeeCell | |
if let cellViewModel = viewModel.employeeCellViewModelForIndexPath(indexPath) { | |
cell.configureWithViewModel(cellViewModel) | |
} | |
return cell | |
// after | |
let cell = tableView.dequeueReusableCellWithIdentifier("EmployeeCell", forIndexPath: indexPath) as EmployeeCell | |
let cellViewModel = viewModel.employeeCellViewModelForIndexPath(indexPath) | |
cellViewModel >>> EmployeeCell.configureWithViewModel(cell) | |
return cell | |
// alternate | |
let cell = tableView.dequeueReusableCellWithIdentifier("EmployeeCell", forIndexPath: indexPath) as EmployeeCell | |
let cellViewModel = viewModel.employeeCellViewModelForIndexPath(indexPath) | |
bind(cellViewModel, EmployeeCell.configureWithViewModel(cell)) | |
return cell | |
// Don't be so clever with the class functions | |
let cell = tableView.dequeueReusableCellWithIdentifier("EmployeeCell", forIndexPath: indexPath) as EmployeeCell | |
let cellViewModel = viewModel.employeeCellViewModelForIndexPath(indexPath) | |
cellViewModel >>> cell.configureWithViewModel | |
return cell | |
// Another alternate | |
let cell = tableView.dequeueReusableCellWithIdentifier("EmployeeCell", forIndexPath: indexPath) as EmployeeCell | |
viewModel.employeeViewModelForIndexPath(indexPath) >>- cell.configureWithViewModel | |
return cell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment