Forked from raulriera/PSPDFTouchForwardingView.swift
Created
August 13, 2017 15:15
-
-
Save lipka/9affc56698116065e83656ed4cf708fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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