I start Safari in an application and want to execute my code after I press Done. But the function func safariViewControllerDidFinish
won't go into.
import SafariServices
class QRScannerController: UIViewController, WKNavigationDelegate, SFSafariViewControllerDelegate {
let vc = SFSafariViewController (url: URL(string: String(urls))!)
present(vc, animated: true, completion: nil)
vc.delegate = self
func safariViewControllerDidFinish(_ controller: SFSafariViewController) {
controller.dismiss(animated: true) {
// do my code
}
You don't need to dismiss the controller inside
safariViewControllerDidFinish
, it is already dismissed when done is tapped.