Skip to content

Instantly share code, notes, and snippets.

@Abhishek9634
Last active August 18, 2018 03:15
Show Gist options
  • Save Abhishek9634/dd0a5bd5ea31c19eefd0059261140afa to your computer and use it in GitHub Desktop.
Save Abhishek9634/dd0a5bd5ea31c19eefd0059261140afa to your computer and use it in GitHub Desktop.
extension BeerListViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView,
numberOfRowsInSection section: Int) -> Int {
return self.viewModel.itemCount
}
func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(
withIdentifier: "BeerTableViewCell"
) as! BeerTableViewCell
cell.delegate = self
cell.item = self.viewModel.item(indexPath)
return cell
}
func tableView(_ tableView: UITableView,
estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return 44.0
}
func tableView(_ tableView: UITableView,
heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment