I have a UIWebView hosted inside UIViewController, I manage to add the right\left gestures in the following way:
var swipeRight = UISwipeGestureRecognizer(target: self, action: "swiped:")
swipeRight.direction = UISwipeGestureRecognizerDirection.Right
self.webView.addGestureRecognizer(swipeRight)
The problem that it's not working with up/down directions:
var swipeDown = UISwipeGestureRecognizer(target: self, action: "swiped:")
swipeDown.direction = UISwipeGestureRecognizerDirection.Down
self.webView.addGestureRecognizer(swipeDown)
I think it's because of the scrolling and I also tried to add it to the scrollview but it still doesn't recognize the up/down gestures:
self.webView.scrollView.addGestureRecognizer(swipeDown)
UPDATE:
I tried Harry answer but it override the default action of swipe up/down and I can't scroll the page:
self.view.addGestureRecognizer(swipeUp)
self.view.addGestureRecognizer(swipeDown)
self.webView.scrollView.panGestureRecognizer.requireGestureRecognizerToFail(swipeUp)
self.webView.scrollView.panGestureRecognizer.requireGestureRecognizerToFail(swipeDown)