Skip to content

Instantly share code, notes, and snippets.

@pranjalsatija
Created February 7, 2020 18:41
Show Gist options
  • Save pranjalsatija/62b6ed7e9b58a3a011eab3328713c85a to your computer and use it in GitHub Desktop.
Save pranjalsatija/62b6ed7e9b58a3a011eab3328713c85a to your computer and use it in GitHub Desktop.
A simple example of conformance to UITableViewDataSource and UITableViewDelegate.
class UITableViewCoordinator: UITableViewDataSource, UITableViewDelegate {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
data.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "identifier") as! Cell
// configure it
return cell
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment