Skip to content

Instantly share code, notes, and snippets.

@matteodanelli
Created January 24, 2017 14:51
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 matteodanelli/2412a7638cb63ceb3caffed73b7510fb to your computer and use it in GitHub Desktop.
Save matteodanelli/2412a7638cb63ceb3caffed73b7510fb to your computer and use it in GitHub Desktop.
UITableViewDataSource
override func numberOfSectionsInTableView(in tableView: UITableView) -> Int {
return NUMBER_OF_SECTIONS
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return NUMBER_OF_ELEMENTS_PER_SECTION
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CELL_IDENTIFIER", for: indexPath)
// set cell's textLabel.text property
// set cell's detailTextLabel.text property
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
// call action in select
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment