Skip to content

Commit

Permalink
fix: fix iPad crash of alert controller (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir authored and rnr committed Sep 6, 2024
1 parent a405dce commit 7c6fea7
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 @@ -122,6 +122,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 7c6fea7

Please sign in to comment.