O'Reilly logo

Swift Functional Programming - Second Edition by Dr. Fatih Nayebi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

TableView delegates and DataSource

Finally, we need to implement the delegate and datasource methods for UITableViewController. The code is as follows:

// MARK: UITableViewController extension MasterViewController {     override func tableView(_ tableView: UITableView,        numberOfRowsInSection section: Int) -> Int {         return viewModel.todos.count     }     override func tableView(_ tableView: UITableView, cellForRowAt         indexPath: IndexPath) -> UITableViewCell {         let cell = tableView.dequeueReusableCell(withIdentifier:            "todoCell", for: indexPath) as! TodoTableViewCell         let todo = viewModel.todoForIndexPath(indexPath)         cell.configure(todo)         return cell     }     override func tableView(_ tableView: UITableView, didSelectRowAt        indexPath: IndexPath) {  let ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required