Skip to content

Commit

Permalink
πŸ› Fix debugger hit test on iPad
Browse files Browse the repository at this point in the history
Take two on 8426b9a. The first approach didnt account for a presented view controller (eg the screen capture confirm dialog) nor system menus.
  • Loading branch information
mmaatttt committed Apr 22, 2024
1 parent 5fc2bf2 commit 4f2a0b6
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ internal class DebugUIWindow: UIWindow {
}

override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
guard let rootView = rootViewController?.view,
let hitView = rootView.hitTest(convert(point, to: rootView), with: event) else {
guard let hitView = super.hitTest(point, with: event), hitView != self else {
return nil
}

// On iPad, there is a system view that wraps the rootView that can capture hits,
// and we need to ignore that view to allow interaction with the underlying app
// while the debug window is overlayed.
if let rootView = rootViewController?.view, hitView.subviews.first == rootView {
return nil
}

Expand Down

0 comments on commit 4f2a0b6

Please sign in to comment.