Limit the scrollable area in UIScrollView

User story:
As a user, you want to swipe right on the left edge of the screen to go back to the previous page. But there is a scroll view there that swallows the swipe.

Easy. Override the hitTest:withEvent: instance method to limit the scroll view hit area.

In the view that contains the scroll view implement this code:

private let leftEdgeHitViewXOffset: CGFloat = 35
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let hitView = super.hitTest(point, with: event)
return point.x < leftEdgeHitViewXOffset ? superview : hitView