Is it possible to disable the pull down dismissal gesture of SFSafariViewController
?
It seems like the SFSafariViewController
runs in its own window, hence, setting isModalInPresentation or even setting the presentationControllerShouldDismiss(_:) doesn't seem to do anything.
The SFSafariViewController
docs don't seem to specify anything here either.
MWE:
import SafariServices
import UIKit
class ViewController: UIViewController, UIAdaptivePresentationControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
let vc = SFSafariViewController(url: URL(string: "https://stackoverflow.com")!)
vc.modalPresentationStyle = .pageSheet
// `presentationControllerShouldDismiss` will be ignored, if isModalInPresentation is set to `true`
// vc.isModalInPresentation = true
vc.presentationController?.delegate = self
self.present(vc, animated: true)
}
}
func presentationControllerShouldDismiss(_ presentationController: UIPresentationController) -> Bool {
return false
}
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
NSLog("Did dismiss")
}
}