I am trying to call a function with parameters using the action of UITapGestureRecognizer
and I can\'t figure out any alternative.
This here is the gesture
The Best way to achieve what you wish is get the superview of your tap gesture, this will give you the correct indexPath. Try this:
func doubleTap(sender: UITapGestureRecognizer) {
let point = sender.view
let mainCell = point?.superview
let main = mainCell?.superview
let cell: myViewCell = main as! myViewCell
let indexPath = collectionView.indexPathForCell(cell)
}
You can increase or reduce the superview's depending on you hierarchy level.