I am working on a grid based game (like minesweeper). It is a 2d grid that I am displaying using a UICollectionView that contains a set of custom UICollectionViewCell cells.
I want to be able to listen to touch events on individual cells. Is it fine to add an UITapGestureRecognizer() to each of the cells (on a 20x20 board, for example). Or is there a better way?
I understand from Ahmad's reply that using this works for single taps:
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
print(indexPath.row)
}
However, I want different event handlers for single vs double taps on the cells.