title: Enabling and Disabling pan gesture on certain condition
body: <p><a href="https://i.stack.imgur.com/u2EpJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u2EpJ.png" alt="I have three views on view controller (Top, middle and Bottom). Pan gesture is applied to the middle view which will go up and down. On going up the top view gets shrink and bottom view gets stretch and on going down vice versa. " /></a></p>
  <pre><code>@IBOutlet weak var topViewHeightConstraint: NSLayoutConstraint!
  @IBOutlet weak var bottomViewHeightConstraint: NSLayoutConstraint!
  @IBOutlet var panGesture: UIPanGestureRecognizer!
  
  @IBAction func panGestureAction(_ sender: UIPanGestureRecognizer) {
      if sender.state == .began || sender.state == .changed{
          let translation = sender.translation(in: sender.view)
          let changeX = (sender.view?.center.x)!
          let changeY = (sender.view?.center.y)! + translation.y
          topViewHeightConstraint.constant = topViewHeightConstraint.constant + translation.y
          bottomViewHeightConstraint.constant = bottomViewHeightConstraint.constant - translation.y
          sender.view?.center = CGPoint(x: changeX, y: changeY)
          sender.setTranslation(CGPoint.zero, in: sender.view)
      }
  }
  </code></pre>
  <p>The above code will decrease the top view's height when the yellow view is dragged upward and increase top view's height on dragging downward. Vice versa for bottom view as well.</p>
  <p>Now I want the pan gesture to stop dragging upward if the top view's height is reduced to certain height lets say 200 px but user should be able to drag downward. Also for bottom view as well user should not go downward if the bottom view's height becomes 200 px.</p>
  <blockquote>
  <p>Anyone please help me with the solution will be greatfull. Thank You!</p>
  </blockquote>