didSelectRowAtIndexPath not working, Swift 3

Swift 3 modified the signature of the method (a lot of methods too, new “rules”/style)

Replace:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: IndexPath) with
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)

Notice the _, the didSelectRowAt vs didSelectRowAtIndexPath, like the other ones you updated (which adapted also the same “style”), but not this one.

Remove the line and let XCode do the autocompletion. Else, you can just replace it with the one from the doc.

Leave a Comment