Find out the parent view of a clicked button in swift
I you don't want to create a custom class and also don't want to use accessibilityHin:
func performAction(_ sender : AnyObject?)
{
let cell = sender?.superview??.superviewOfClassType(UITableViewCell.self) as! UITableViewCell
let tbl = cell.superviewOfClassType(UITableView.self) as! UITableView
let indexPath = tbl.indexPath(for: cell)
let myData = myDataArray[indexPath.row]
...
}
Please try the following
sender.superview