Q:

Swift 3.0 UITableViewDelege Objective-c method does not match the requirement's selector

I recently converted a project to Swift 3 with Xcode 8.0 and I got a error on a function which I don't understand very well. On these lines:
extension HomeTableViewController : UITableViewDelegate {

    func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {

    }
}

To resolve the error, Xcode tells me to add @objc(tableView:commitEditingStyle:forRowAtIndexPath:) just before the method.

Okay, it works, but I don't get why it is only required for this method.
Xcode doesn't require to add the @objc stuff in front of my  tableView:heighForHeaderInSection but I don't see any differences in the UITableViewDelegate between this method and the  tableView:commitEditingStyle:forRowAtIndexPath:.
So, know why is this mandatory for the tableView:commitEditingStyle:forRowAtIndexPath method ?
Thanks in advance! 

A:

You are adopting the incorrect protocol in your extension. The tableView:commitEditingStyle:forRowAtIndexPath: method is part of the UITableViewDataSource protocol. Change your extension to adopt the UITableViewDataSource protocol instead of the UITableViewDelegate protocol and the error goes away.
At least this worked for me when I got this error with NSCollectionViewDelegate/DataSource extensions.

