Answers for "how to add left and right swipe gesture to a uiview swift ios"

1

swift swipe gesture

override func viewDidLoad() {
    super.viewDidLoad()
        
    let leftSwipe = UISwipeGestureRecognizer(target: self, action: #selector(handleSwipes(_:)))
    let rightSwipe = UISwipeGestureRecognizer(target: self, action: #selector(handleSwipes(_:)))
        
    leftSwipe.direction = .left
    rightSwipe.direction = .right

    view.addGestureRecognizer(leftSwipe)
    view.addGestureRecognizer(rightSwipe)
}
Posted by: Guest on November-16-2020

Code answers related to "how to add left and right swipe gesture to a uiview swift ios"

Code answers related to "Swift"

Browse Popular Code Answers by Language