0

I'm working on an iOS app that's programmed in Swift and for some reason my app is unable to recognize/handle the swipe right gesture. Here is my code:

self.feedTableViewCell.productPreview.userInteractionEnabled = true
var swipeLeft = UISwipeGestureRecognizer(target: self, action: Selector("respondToSwipeGesture:"))
swipeLeft.direction = UISwipeGestureRecognizerDirection.Left
self.feedTableViewCell.productPreview.addGestureRecognizer(swipeLeft)

var swipeRight = UISwipeGestureRecognizer(target: self, action: Selector("respondToSwipeGesture:"))
swipeRight.direction = UISwipeGestureRecognizerDirection.Right
self.feedTableViewCell.productPreview.addGestureRecognizer(swipeRight)

And here's my handler:

func respondToSwipeGesture(swipeGesture: UISwipeGestureRecognizer) {
    switch swipeGesture.direction {
    case UISwipeGestureRecognizerDirection.Left:
        println("swipe left")
    case UISwipeGestureRecognizerDirection.Right:
        println("swipe right")
    default:
        println("Unknown gesture")
        break
    }

    self.feedTableViewCell.pageControl.currentPage = self.currentFeedImage
}

I'm able to swipe to the left fine, but when I swipe right, the app crashes and I get an (lldp) error. Any help greatly appreciated!

rmaddy
  • 314,917
  • 42
  • 532
  • 579
dahveed707
  • 907
  • 6
  • 14
  • Did you try placing a breakpoint within your handler function? On which line does the app crash? – BenJammin Jun 30 '15 at 03:07
  • I see no issue in the code above. check if there is any issue with your pageControl – Shoaib Jun 30 '15 at 04:40
  • Go through this code you will able to sort your self http://stackoverflow.com/questions/32583903/how-to-implement-swipe-left-and-swipe-right-to-reveal-different-kind-of-labels – Ankahathara Sep 15 '15 at 10:49

0 Answers0