Hi,
At one point the author makes us write this code below, now what is the table view delegate mean here , in the earlier code the table view was asking for how many rows to display etc and we were providing it the info, though I do not still fully understand how that was happening , but here what is the tableview trying to do,
is it asking a question , then why call it a delegate, is it saying then when a row is tapped do this? If so to whom the Information is getting passed, to the tableView itself ?
Why we call it a delegate ? Why we use tableView: UITableView, again and again , kindly guide , thanks
// MARK:- Table View Delegate
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if let cell = tableView.cellForRow(at: indexPath) {
if cell.accessoryType == .none {
cell.accessoryType = .checkmark
}
else {
cell.accessoryType = .none
}
}
tableView.deselectRow(at: indexPath, animated: true)
}