Came to this after seeing some similar problems that I saw when trying to use SafariViewController. Tracked my problems before using SafariViewController when a popup appeared. Compose code to show my problem and possible solution.

ViewController.swift:
import UIKit import SafariServices class ViewController: UIViewController, UIPopoverPresentationControllerDelegate, PopButtonPressedProtocol { @IBOutlet weak var btnAlwaysGood: UIButton! @IBOutlet weak var btnPopup: UIBarButtonItem! let webAddr = "http://www.google.com" func delay(_ delay: Double, closure:@escaping ()->()) { DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(delay * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC), execute: closure) } func showSVC() { let svc = SFSafariViewController(url: URL(string: webAddr)!) self.present(svc, animated: true, completion: nil) } func popButtonPressed(_ button: UIButton) { if let title = button.currentTitle { switch title { case "Bad": dismiss(animated: true, completion: nil) showSVC() case "Good": dismiss(animated: false, completion: nil) delay(0.5, closure: { self.showSVC() }) default: break } } } func popupButtonPressed() { performSegue(withIdentifier: "popup", sender: nil) } func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
PopVC.swift:
import UIKit protocol PopButtonPressedProtocol : class { func popButtonPressed(_ button: UIButton)
source share