An object that provides a standard interface for browsing the web.
- iOS 9.0+
The view controller includes Safari features such as Reader, AutoFill, Fraudulent Website Detection, and content blocking. In iOS 9 and 10, it shares cookies and other website data with Safari. The user's activity and interaction with
SFSafari are not visible to your app, which cannot access AutoFill data, browsing history, or website data. You do not need to secure data between your app and Safari. If you would like to share data between your app and Safari in iOS 11 and later, so it is easier for a user to log in only one time, use
UI features include the following:
A read-only address field with a security indicator and a Reader button
An Action button that invokes an activity view controller offering custom services from your app, and activities, such as messaging, from the system and other extensions
A Done button, back and forward navigation buttons, and a button to open the page directly in Safari
On devices that support 3D Touch, automatic Peek and Pop for links and detected data
Choosing the Best Web Viewing Class
If your app lets users view websites from anywhere on the Internet, use the
SFSafari class. If your app customizes, interacts with, or controls the display of web content, use the
When you adopt
SFSafari and a user presses a link to peek at and then pop to the link’s destination, the user views web content from within your app. Tapping Done, the user returns to the view controller that was displayed before the web content was loaded. When you instead use the
WKWeb class, Peek and Pop sends the user to Safari by default.