How can I get the scroll/swipe direction for up/down in a VC?
I want to add a UIScrollView or something else in my VC that can see if the user swipes/scrolls up or d
extension UIScrollView { enum ScrollDirection { case up, down, unknown } var scrollDirection: ScrollDirection { guard let superview = superview else { return .unknown } return panGestureRecognizer.translation(in: superview).y > 0 ? .down : .up } }