I have UIScrollView and the scroll view frame is not equal to the UIView frame. So, scroll view contents are not swiped while swiping outside the scroll view frame. But I want the whole screen responsive for the scroll view though the scroll view doesn't cover full screen. I know that can be done by making the scroll view frame equal to the view frame.But I don't want to do it. I tried other possible solutions I found so far. But nothing is working as I want. I need to do this using gesture recognizer.
Following is my code:
override func viewDidLoad() {
        super.viewDidLoad()
        scrollView.delegate = self
        let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(self.respondToSwipeGesture))
        swipeRight.direction = UISwipeGestureRecognizerDirection.right
        self.view.addGestureRecognizer(swipeRight)
        let swipeLeft = UISwipeGestureRecognizer(target: self, action: #selector(self.respondToSwipeGesture))
        swipeLeft.direction = UISwipeGestureRecognizerDirection.left
        self.view.addGestureRecognizer(swipeLeft)
}
func respondToSwipeGesture(gesture: UIGestureRecognizer) {
        if let swipeGesture = gesture as? UISwipeGestureRecognizer {
            switch swipeGesture.direction {
            case UISwipeGestureRecognizerDirection.right:
                scrollView.panGestureRecognizer.isEnabled = true
            case UISwipeGestureRecognizerDirection.left:
                 scrollView.panGestureRecognizer.isEnabled = true
            default:
                break
            }
        }
    }
This is my view controller and the blue background is the scroll view. Swipe gesture works only on that blue region. But I want it to work through the screen even in corners. How can I achieve it using gesture recognizer?

 
    
 
     
    