title: How would I make a UiPanGestureRecognizer check if the finger is in the buttons frame?
body: <p>I am trying to make an app where the user could drag a finger on top of multiple buttons and get some actions for each button.</p>
  <p>There was <a href="https://stackoverflow.com/questions/29172160/how-to-swipe-multi-buttons-with-one-touch">a similar question</a> from a while back but when I tried to use <code>CGRectContainsPoint(button.frame, point)</code> it said it was replaced with <code>button.frame.contains(point)</code> but this didn’t seem to work for me. <a href="https://i.stack.imgur.com/pWmqT.png" rel="nofollow noreferrer">Here is a link to the Photo</a></p>
  <p>What I have done so far:</p>
  <pre><code>var buttonArray:NSMutableArray!
  
  override func viewDidLoad()
  {
      super.viewDidLoad()
      let panGesture = UIPanGestureRecognizer(target: self, action: #selector(panGestureMethod(_:)))
      a1.addGestureRecognizer(panGesture)
      a2.addGestureRecognizer(panGesture)
  }
  @objc func panGestureMethod(_ gesture: UIPanGestureRecognizer) {
      
      
      if gesture.state == UIGestureRecognizer.State.began {
          buttonArray = NSMutableArray()
      }
      
      let pointInView = gesture.location(in: gesture.view)
      
      if !buttonArray.contains(a1!) &amp;&amp; a1.frame.contains(pointInView) {
          buttonArray.add(a1!)
          a1Tapped(a1)
      }
      else if !buttonArray.contains(a2!) &amp;&amp; a2.frame.contains(pointInView) {
          buttonArray.add(a2!)
          a2Tapped(a2)
      }
  </code></pre>
  <p>The code did run fine but when I tried to activate the drag nothing happened. Any tips?</p>