Swipe gesture in Swift 3

后端 未结 7 1225
感动是毒
感动是毒 2020-12-07 17:33

Im trying to get a UISwipeGestureRecognizer to work in Swift 3, the default swipe right is working correctly though not up down or left.

I have tried it by control d

7条回答
  •  情深已故
    2020-12-07 18:05

    I was having the same problem. Actually, any swipe just crashed my code (from Rob Percival, right?). So I downloaded his finished code, opened it in XCode 8 and let it convert to Swift 3. Two points were changed.

    In ViewDidLoad:
      let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(ViewController.swiped(_:)))
    

    And inside the function:

    func swiped(_ gesture: UIGestureRecognizer)
    

提交回复
热议问题