I\'d like to add a gesture to my app so when the user swipes vertically it triggers a method to do something. The swipe can be up or down. I\'ve never done anything with g
In swift 4.0, that goes on the method didFinishLaunchingWithOptions of the AppDelegate:
let swipeGesture = UISwipeGestureRecognizer(target: self, action: #selector(self.swipedScreen(swipeGesture:)))
swipeGesture.numberOfTouchesRequired = 2
swipeGesture.direction = [UISwipeGestureRecognizerDirection.up, UISwipeGestureRecognizerDirection.down]
window?.addGestureRecognizer(swipeGesture)
And the action:
@objc func swipedScreen(swipeGesture: UISwipeGestureRecognizer){
Swift.print("hy")
}