title: Strange Behavior with UITapGestureRecognizer
body: <p>I implemented a SnackBar / Toast Message in Swift 4 which allows the developer to set the following display duration (enum) and with the following behaviour:</p>
  
  <ul>
  <li><p>.long / .short: Timer gets fired and dismisses the SnackBar <strong>OR the user taps the view and it also dismisses</strong></p></li>
  <li><p>.constant: No Timer, only TapGesture to dismiss</p></li>
  </ul>
  
  <p>Now in the first case (.long / .short) the SnackBar reacts as expected. Either the Timer fires or the user taps and the view gets dismissed. </p>
  
  <p><strong>In the second case (.constant) - where there is no timer - the Tap gesture is not recognised and the view doesn't get dismissed</strong></p>
  
  <p>here are the three functions:</p>
  
  <pre><code>    private func defineDismissMode(){
          switch self.message.duration {
          case .short, .long:
              self.setTimer()
          case .constant:
              self.setTapGesture()
          }
      }
  
      private func setTimer(){
          guard self.timer == nil else {return}
          self.timer = Timer.scheduledTimer(timeInterval: self.message.duration.rawValue, target: self, selector: #selector(self.dismissSnackBar), userInfo: nil, repeats: false)
          self.setTapGesture()
      }
  
      private func setTapGesture() {
          self.tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.dismissSnackBar))
          self.snackView.addGestureRecognizer(self.tapGestureRecognizer!)
      }
  
      @objc private func dismissSnackBar(){
        ...
      }
  </code></pre>
  
  <p>Anyone a clue why when <code>setTapGesture()</code> is called after <code>setTimer()</code> it works and a tap triggers <code>self.dismissSnackBar</code> , but when called without <code>setTimer()</code> the UITapGestureRecognizer is not triggered?</p>
  
  <p>Note: Yes I checked that <code>case: .constant -&gt; setTapGesture()</code> gets called</p>