A protocol used to implement event handling in a Safari app extension.
SDK
- macOS 10.12+
Framework
- Safari
Services
Declaration
protocol SFSafariExtensionHandling
A protocol used to implement event handling in a Safari app extension.
SDK
Framework
protocol SFSafariExtensionHandling
func message Received(with Name: String, from: SFSafari Page, user Info: [String : Any]?)
Called when a message is received from an injected script.
func message Received From Containing App(with Name: String, user Info: [String : Any]?)
Called when a message is received from the extension's containing app.
func context Menu Item Selected(with Command: String, in: SFSafari Page, user Info: [String : Any]?)
Called when one of the app extension's context menu items is selected.
func validate Context Menu Item(with Command: String, in: SFSafari Page, user Info: [String : Any]?, validation Handler: (Bool, String?) -> Void)
Validates whether a particular contextual menu item should be displayed.
func toolbar Item Clicked(in: SFSafari Window)
Called when a toolbar item associated with the app extension is clicked.
func validate Toolbar Item(in: SFSafari Window, validation Handler: (Bool, String) -> Void)
Called in response to a requested update or a browser state change that may affect the toolbar item.
func popover View Controller() -> SFSafari Extension View Controller
Asks the handler to provide a popover view controller for display.
func popover Will Show(in: SFSafari Window)
Tells the handler that the app extension's popover is about to be opened.
func popover Did Close(in: SFSafari Window)
Tells the handler that the app extension's popover was closed.
Learn how you can affect the appearance or behavior of a webpage by using injected style sheets and scripts.
Inject a script that you've written from a Safari App Extension into a webpage.
Add to or override styles by injecting CSS style sheets into webpages.
Pass data back and forth between Safari App Extension and injected scripts.
class SFSafari Extension Handler
A base class that you subclass to handle events in your Safari app extension.
class SFSafari Extension Manager
A class used by your app to find out the current state of a Safari app extension.
class SFSafari Extension State
The state of a Safari app extension.
class SFSafari Page Properties
Information about a webpage.