title: How to make a view follow my finger to move? Direction is from left to right
body: <p>I want to implement a function similar to a slider. For example, the button follows the finger and moves from left to right.
  Like this:
  <a href="https://i.stack.imgur.com/pkNlu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pkNlu.png" alt="enter image description here"></a></p>
  
  <p>Should I use UISwipeGestureRecognizer. Or UIPanGestureRecognizer？
  I used a swipe gesture but I don't know how to update the frame.</p>
  
  <pre><code>var swipeRight = UISwipeGestureRecognizer(target: self, action: 
  #selector(self.respondToSwipeGesture(sender:)))
  swipeView.isUserInteractionEnabled = true
  swipeView.addGestureRecognizer(swipeRight)
  </code></pre>