In Swift 2 this used to work (I have left out table view methods intentionally)...
import Foundation
import UIKit
private extension Selector {
static let didTapButton = #selector(TableVC.buttonTapped(_ :))
}
class TableVC: UITableViewController{
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let btnAccView:UIButton = UIButton(frame: CGRectMake(0, 0, 27, 27))
btnAccView.addTarget(self, action: .didTapButton, forControlEvents: UIControlEvents.TouchUpInside)
btnAccView.tag = indexPath.row
}
func buttonTapped(sender: UIButton){
print("button tapped at row \(sender.tag)")
}
}
In Swift 3 this causes the error : "TableVC has no member buttonTapped".
I just need to write a selector that takes an argument. I have tried fiddling with the syntax in every way I can think of but nothing has worked. Thanks for your help