Adding a UITapGestureRecognizer to a UIView is very straighforward. All you do is setup the gesture and then assign it to the view. Could not be much easier could it.
let tapRecogniser = UITapGestureRecognizer(target: self, action: #selector(ViewController.viewPressed(_:)))
There are a couple of points just to hightlight. Firstly if you are using a UIImageView then you will need to add in the […]