Open a web url without leaving your app

Jesus Guerra
Jan 15, 2019 · 2 min read
Photo by Chen Hu on Unsplash

What is SFSafariViewController?

SFSafariViewController is an object that provides a visible standard interface for browsing the web. The view controller includes Safari features such as Reader, AutoFill, Fraudulent Website Detection, and content blocking.

Something to take in mind is that the user’s activity and interaction with SFSafariViewController are not visible to your app, which cannot access AutoFill data, browsing history, or website data.

In accordance with App Store Review Guidelines, this view controller must be used to visibly present information to users; the controller may not be hidden or obscured by other views or layers. Additionally, an app may not use SFSafariViewController to track users without their knowledge and consent.

How to use it?

SFSafariViewController is part of the SafariServices Framework, so first you will need to import this framework then create and instance of SFSafariViewController and just present it.

Your view controller should look something like this:

openLink holds the logic to Present SFSafariViewController


Life is really simple, but we insist on making it complicated.
— Confucius

Thanks for reading and hope you find this article helpful. As usual any feedback or comment is welcome. And if you want to waste some of your time, follow me on twitter @guerrix

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store