Search code examples
iosswiftmobile

How to show a SFSafariViewController without the option to open it in a browser


I am using a SFSafariViewController for a sign-in page. I want to disable the option to open the webpage in an external browser. Is there a simple way to hide the browser icon in the bottom right corner?

if let url = URL(string: "[URL]") {
    let vc = SFSafariViewController(url: url)
    vc.modalPresentationStyle = .pageSheet
    vc.dismissButtonStyle = .cancel
    present(vc, animated: true)
}

I couldn't find any easy solution. Do I need to recreate the entire view?

The icon I want to hide: The icon I want to hide


Solution

  • I wasn't aware of ASWebAuthenticationSession, but it suits my needs better and offers the exact options I need.