Created
March 30, 2018 13:44
-
-
Save rtking1993/69e4cce03241fc6f4f10c9f6d1c314de to your computer and use it in GitHub Desktop.
Datasource methods for a UITableView
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
// MARK: UITableViewDataSource Methods | |
extension MainViewController: UITableViewDataSource { | |
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return items.count | |
} | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "Cell") | |
let item = items[indexPath.row] | |
cell.textLabel?.text = item.item | |
return cell | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment