Answers for "swift swipe button"

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
0

using swipe gesture recognizer swift

@IBAction func swipeHandler(_ gestureRecognizer : UISwipeGestureRecognizer) {
    if gestureRecognizer.state == .ended {
        // Perform action.
    }
}
Posted by: Guest on December-28-2019

Code answers related to "Swift"

Browse Popular Code Answers by Language