I just ran into this issue and this works pretty well for me:
final class PassthroughWindow: UIWindow {
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
guard let hitView = super.hitTest(point, with: event),
let rootView = rootViewController?.view
else {
return nil
}
if #available(iOS 18, *) {
for subview in rootView.subviews.reversed() {
let convertedPoint = subview.convert(point, from: rootView)
if subview.hitTest(convertedPoint, with: event) != nil {
return hitView
}
}
return nil
} else {
return hitView == rootView ? nil : hitView
}
}
}
Topic:
UI Frameworks
SubTopic:
General
Tags: