Skip to content

Instantly share code, notes, and snippets.

@emrepun
Created July 1, 2018 11:02
Show Gist options
  • Save emrepun/0e3dc73f637def50633ef81cdd738840 to your computer and use it in GitHub Desktop.
Save emrepun/0e3dc73f637def50633ef81cdd738840 to your computer and use it in GitHub Desktop.
random func
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return userArray.value.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell") else {
return UITableViewCell()
}
cell.textLabel?.text = userArray.value[indexPath.row].name
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
userToShowInFirstVc.value = userArray.value[indexPath.row]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment