Open a web url without leaving your app
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
SFSafariViewControllerto 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:
- Apple Documentation: SFSafariViewController
Life is really simple, but we insist on making it complicated.
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