title: Double Tap Recognition over UIWebView - Swift 3
body: <p>I'm trying to implement Gesture recognizer over UIWebView to detect double taps. But there is no recognition. </p>
  
  <p>I have looked over web for a few tutorials and I could compile to this. Code below. But there is no success.</p>
  
  <pre><code>class PageContentViewController: UIViewController, UIGestureRecognizerDelegate, UIWebViewDelegate  {
  
  @IBOutlet weak var webView: UIWebView!
  
  var pageIndex: Int = 0
  var strTitle: String!
  var flag : Int = 0
  
  override func viewDidLoad() {
      super.viewDidLoad()
      webView.delegate = self
  
      DispatchQueue.main.async {
      let req = URLRequest(url: URL(fileURLWithPath: Bundle.main.path(forResource: self.strTitle+"/index" , ofType: "html")!))
      self.webView.loadRequest(req)
      self.view.addSubview(self.webView)
  
      }
  
      let tapGestureRecognizer = UITapGestureRecognizer(target:self, action:#selector(self.goToback))
      tapGestureRecognizer.delegate? = self
      tapGestureRecognizer.numberOfTapsRequired = 2
      webView.isUserInteractionEnabled = true
      webView.addGestureRecognizer(tapGestureRecognizer)
      webView.scrollView.addGestureRecognizer(tapGestureRecognizer)
      webView.gestureRecognizerShouldBegin(tapGestureRecognizer)
  }
  
  
  func gestureRecognizer(_: UIGestureRecognizer,  shouldRecognizeSimultaneouslyWith:UIGestureRecognizer) -&gt; Bool {
      return true
  }
  func gestureRecognizer(_: UIGestureRecognizer, shouldReceive:UITouch) -&gt; Bool {
      return true
  }
  
  
  func goToback(){
      print("On the Back")
  }
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/pTouz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pTouz.png" alt="This picture contains webview in orange"></a>
  <a href="https://i.stack.imgur.com/P0MMI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P0MMI.png" alt="Attribute Inspector for UIWebView"></a></p>
  
  <p>What is wrong in the code.?</p>
  
  <p>I'm noob to swift. </p>
  
  <p>Thanks in advance</p>