Protocol

SFSafariExtensionHandling

A protocol used to implement event handling in a Safari app extension.

Topics

Receiving Messages in Your App Extension

func messageReceivedFromContainingApp(withName: String, userInfo: [String : Any]? = nil)

Called when a message is received from the extension's containing app.

Responding to Context Menu Selections

Working with Toolbar Items

func toolbarItemClicked(in: SFSafariWindow)

Called when a toolbar item associated with the app extension is clicked.

func validateToolbarItem(in: SFSafariWindow, validationHandler: (Bool, String) -> Void)

Called in response to a requested update or a browser state change that may affect the toolbar item.

Working with Popovers

func popoverViewController() -> SFSafariExtensionViewController

Asks the handler to provide a popover view controller for display.

func popoverWillShow(in: SFSafariWindow)

Tells the handler that the app extension's popover is about to be opened.

func popoverDidClose(in: SFSafariWindow)

Tells the handler that the app extension's popover was closed.

Relationships

Inherits From

See Also

Injecting Scripts and Style Sheets

About Injected Style Sheets and Scripts

Learn how you can affect the appearance or behavior of a webpage by using injected style sheets and scripts.

Injecting a Script into a Webpage

Inject a script that you've written from a Safari App Extension into a webpage.

Injecting CSS Style Sheets into a Webpage

Add to or override styles by injecting CSS style sheets into webpages.

Passing Messages Between Safari App Extensions and Injected Scripts

Pass data back and forth between Safari App Extension and injected scripts.

class SFSafariExtensionHandler

A base class that you subclass to handle events in your Safari app extension.

class SFSafariExtensionManager

A class used by your app to find out the current state of a Safari app extension.

class SFSafariExtensionState

The state of a Safari app extension.

class SFSafariPageProperties

Information about a webpage.