diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index e48dd3471..7591da1b2 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -273,8 +273,7 @@ class WebViewController: UIViewController { if AppDefaults.shared.useSystemBrowser { UIApplication.shared.open(url, options: [:]) } else { - let vc = SFSafariViewController(url: url) - present(vc, animated: true) + openURLInSafariViewController(url) } } } @@ -378,8 +377,7 @@ extension WebViewController: WKNavigationDelegate { guard didOpen == false else { return } - let vc = SFSafariViewController(url: url) - self.present(vc, animated: true) + self.openURLInSafariViewController(url) } } @@ -794,11 +792,16 @@ private extension WebViewController { guard didOpen == false else { return } - let vc = SFSafariViewController(url: url) - self.present(vc, animated: true) + self.openURLInSafariViewController(url) } } + func openURLInSafariViewController(_ url: URL) { + + let viewController = SFSafariViewController(url: url) + viewController.modalPresentationStyle = .overFullScreen // This avoids a crash with .fullScreen + present(viewController, animated: true) + } } // MARK: Find in Article diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index a64c160e9..185f72faf 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -676,6 +676,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { if let indexPath = coordinator.currentFeedIndexPath, let url = coordinator.homePageURLForFeed(indexPath) { let vc = SFSafariViewController(url: url) + vc.modalPresentationStyle = .overFullScreen present(vc, animated: true) } }