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!