0

How can I get the indexPath.row when a button is tapped? Here is the code I have now:

let alert = SCLAlertView()
let txt = alert.addTextField("Quantity")
txt.keyboardType = UIKeyboardType.NumberPad
txt.text = "\(1)"

alert.addButton("Add to cart") {
    var sar:Cart!
    let indexPath = self.tableView?.indexPathForSelectedRow
    print("\(indexPath.row)")
}

But it didn't work.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
ben fo
  • 21
  • 6

0 Answers0