Limit UIView movement to only vertical or horizontal axis
I'm using a PanGestureRecognizer and in the UIGestureRecognizerStateChanged I let a view on the screen be moved by the users finger. I'm using that for a Tinder like swipe away gesture and I now want to limit the movement of the view to either the horizontal axis or the vertical axis, whatever direction the user started to swipe. I've been searching up and down but didn't find anything suitable here. Is there any clever way to limit the axis movement, based on which direction the user started to swipe the view? Thanks a bunch! Update: Here's the current code that moves the view: - (void