Skip to content

Commit

Permalink
fix: fix iPad crash of alert controller (#74) (#521)
Browse files Browse the repository at this point in the history
Co-authored-by: Saeed Bashir <[email protected]>
  • Loading branch information
rnr and saeedbashir authored Sep 30, 2024
1 parent 61b3e37 commit 8dbdcb2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Core/Core/View/Base/Webview/WebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,17 @@ public struct WebView: UIViewRepresentable {
handler: { _ in
completionHandler(false)
}))

if let presenter = alertController.popoverPresentationController {
let view = UIApplication.topViewController()?.view
presenter.sourceView = view
presenter.sourceRect = CGRect(
x: view?.bounds.midX ?? 0,
y: view?.bounds.midY ?? 0,
width: 0,
height: 0
)
}

UIApplication.topViewController()?.present(alertController, animated: true, completion: nil)
}
Expand Down

0 comments on commit 8dbdcb2

Please sign in to comment.