Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lipka/9affc56698116065e83656ed4cf708fc to your computer and use it in GitHub Desktop.
Save lipka/9affc56698116065e83656ed4cf708fc to your computer and use it in GitHub Desktop.
import UIKit
// This class allows the "presentedController" to receive touches
// https://pspdfkit.com/blog/2015/presentation-controllers/
class PSPDFTouchForwardingView: UIView {
var passthroughViews: [UIView] = []
override func hitTest(point: CGPoint, withEvent event: UIEvent?) -> UIView? {
guard let hitView = super.hitTest(point, withEvent: event) else { return nil }
guard hitView == self else { return hitView }
for passthroughView in passthroughViews {
let point = convertPoint(point, toView: passthroughView)
if let passthroughHitView = passthroughView.hitTest(point, withEvent: event) {
return passthroughHitView
}
}
return self
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment