Skip to content

Instantly share code, notes, and snippets.

@yabenatti
Created November 10, 2017 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yabenatti/56852de86450e0ec1bd5872a6490b187 to your computer and use it in GitHub Desktop.
Save yabenatti/56852de86450e0ec1bd5872a6490b187 to your computer and use it in GitHub Desktop.
MiniCursoIFSPSwiftTableViewDataSource
extension HomeViewController : UITableViewDataSource {
//Métodos obrigatórios
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.animalsArray.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: homeCellIndentifier, for: indexPath) as? HomeTableViewCell else {
fatalError("Cannot create Home Table View Cell")
}
cell.initWithAnimal(animal: self.animalsArray[indexPath.row])
return cell
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment