Author Topic: How to fix problems with the table view indexPathForSelectedRow in Swift 2.0  (Read 5543 times)


  • Administrator
  • *****
  • Posts: 719
    • View Profile
In Swift 2.0, the indexPathForSelectedRow() method has been changed to a property, so you need to remove the parentheses when referencing it.

For example, the following code references the method:

Code: [Select]
let indexPath = self.tableView.indexPathForSelectedRow()!
And should be changed to:

Code: [Select]
let indexPath = self.tableView.indexPathForSelectedRow!
All the best!
Kevin McNeish
Author of Learn to Code in Swift:
Check out our Robot Tic-Tac-Toe app:
« Last Edit: November 15, 2015, 10:12:01 AM by kjmcneish »