<!--
{
  "availability" : [
    "macOS: 10.12.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SafariServices",
  "identifier" : "/documentation/SafariServices/SFSafariApplication",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Safari Services"
    ],
    "preciseIdentifier" : "c:objc(cs)SFSafariApplication"
  },
  "title" : "SFSafariApplication"
}
-->

# SFSafariApplication

A proxy for the Safari app.

```
class SFSafariApplication
```

## Overview

The `SFSafariApplication` class is used by a Safari app extension to access the active Safari window, open a new window, and update the toolbar items on a window. An application that acts as a host container for a Safari app extension can use this class to send messages to the app extension. There is no object instance for this class.

## Topics

### Communicating With the App Extension

[`+  dispatchMessageWithName:toExtensionWithIdentifier:userInfo:completionHandler:`](/documentation/SafariServices/SFSafariApplication/dispatchMessage(withName:toExtensionWithIdentifier:userInfo:completionHandler:))

Sends a message to a Safari app extension, launching Safari if necessary.

### Working with Windows

[`+  getActiveWindowWithCompletionHandler:`](/documentation/SafariServices/SFSafariApplication/getActiveWindow(completionHandler:))

Calls the completion handler with the active browser window.

[`+  openWindowWithURL:completionHandler:`](/documentation/SafariServices/SFSafariApplication/openWindow(with:completionHandler:))

Opens a new window with the desired webpage.

[`+  showPreferencesForExtensionWithIdentifier:completionHandler:`](/documentation/SafariServices/SFSafariApplication/showPreferencesForExtension(withIdentifier:completionHandler:))

Launches Safari and opens the preferences panel for a Safari app extension.

### Updating Toolbar Items

[`+  setToolbarItemsNeedUpdate`](/documentation/SafariServices/SFSafariApplication/setToolbarItemsNeedUpdate())

Updates the enabled states and badges of toolbar items.

### Type Methods

[`+  getAllWindowsWithCompletionHandler:`](/documentation/SafariServices/SFSafariApplication/getAllWindows(completionHandler:))

[`+  getHostApplicationWithCompletionHandler:`](/documentation/SafariServices/SFSafariApplication/getHostApplication(completionHandler:))

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)