Framework

SafariServices

Enable web views and services in your app.

Overview

Use the Safari Services framework to integrate Safari behaviors into your iOS or macOS app or to extend the behavior of Safari.

You can:

  • Provide a user interface that is almost identical to the user interface provided by the Safari app. Users can browse the web in this view and then return to your app’s content. This view is more consistent with the Safari user interface than implementing your own custom browsing solution and can be done using fewer lines of code. (iOS)

  • Add items to the user’s Safari Reading List. (iOS)

  • Determine from your app whether your content blocker extension is loaded, and if it is, tell it to refresh its contents. (iOS and macOS)

  • Implement Safari app extensions. Determine from your app whether a Safari app extension is loaded. (macOS)

  • Allow the user to share cookies and website data between an app and Safari for a single sign-on (SSO) experience with SFAuthenticationSession.

Topics

Availability

func SFSafariServicesAvailable(SFSafariServicesVersion) -> Bool

Indicates whether a given version of Safari services is available.

enum SFSafariServicesVersion

The version of Safari services.

Safari Content Display in Your App

class SFSafariViewController

An object that provides a visible standard interface for browsing the web.

class SFAuthenticationSession

A class that manages sharing a one-time login between Safari and an app, which can also be used for automatic login for associated apps.

Deprecated
typealias SFAuthenticationSession.CompletionHandler

The completion handler for an authentication session when the user cancels or finishes the login.

Safari Reading List

class SSReadingList

An object used to add items to a user’s Safari Reading List.

let SSReadingListErrorDomain: String

The domain for Safari Reading List errors.

enum SSReadingListError.Code

Messages that describe a Safari Reading List error.

struct SSReadingListError

A Safari Reading List error.

Content Blockers

Creating a Content Blocker

Create a Content Blocker for Safari in Xcode.

class SFContentBlockerManager

A class used by your app to interact with a content blocker extension.

class SFContentBlockerState

The state of a content blocker extension.

let SFContentBlockerErrorDomain: String

The domain for content blocker errors.

Deprecated
enum SFContentBlockerErrorCode

Messages that describe a content blocker error.

Deprecated

Safari App Extensions

Safari App Extensions

Learn how Safari app extensions extend the web-browsing experience in Safari by leveraging web technologies and native code.

class SFSafariApplication

A proxy for the Safari app.

class SFSafariWindow

A proxy for a Safari window.

class SFSafariPage

A proxy for a Safari webpage.

class SFSafariTab

A proxy for a tab in a Safari window.

Miscellaneous Errors

struct SFAuthenticationError

An authentication error.

Deprecated
enum SFAuthenticationError.Code

Messages that describe an authentication error.

Deprecated
let SFAuthenticationErrorDomain: String

The domain for authentication errors.

Deprecated
struct SFError

A content blocker or Safari app extension error.

enum SFError.Code

Messages that describe a content blocker or Safari app extension error.

let SFErrorDomain: String

The domain for content blocker or Safari app extension errors.