tabledatasource
extension ViewController: UITableViewDataSource { | |
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
if tableView == firstTable { | |
return firstData.count | |
} | |
return secondData.count | |
} | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
if tableView == firstTable { | |
let cell = firstTable.dequeueReusableCell(withIdentifier: "firstcell", for: indexPath) | |
cell.textLabel?.text = firstData[indexPath.row].description | |
return cell | |
} else { | |
let cell = secondTable.dequeueReusableCell(withIdentifier: "secondcell", for: indexPath) | |
cell.textLabel?.text = secondData[indexPath.row] | |
return cell | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment