title: swift UITapGestureRecognizer not working on view
body: <p>I had to create a new thread bcoz it's driving me crazy and all the other answers online are exactly the same. I have done this countless of times but I cannot see what I am missing for the life of me. I am using a &quot;test&quot; view controller just to get the tap gesture working but it isn't working at all... I am fairly certain that I am setting this up correctly, as this is how I've always implemented it in the past: (yes, I have checked the box for isUserInteractionEnabled). I am even implementing this on a different viewcontroller this exact way and it is working...</p>
  <pre><code>class TestViewController: UIViewController {
  
    override func viewDidLoad() {
      super.viewDidLoad()
      view.addGestureRecognizer(tap)
    }
  
    let tap = UITapGestureRecognizer(target: self, action: #selector(wasTapped))
  
      
    @objc func wasTapped() {
      print(&quot;tapped&quot;)
    }
  }
  </code></pre>
  <p>I have also tried adding the parameters to wasTapped:</p>
  <pre><code>@objc func wasTapped(gestureRecognizer: UITapGestureRecognizer) {
    print(&quot;tapped&quot;)
  }
  </code></pre>