Contents

open(_:completionHandler:)

Asks the system to open a URL on behalf of the currently running app extension.

Declaration

func open(_ URL: URL, completionHandler: (@Sendable (Bool) -> Void)? = nil)
func open(_ URL: URL) async -> Bool

Parameters

  • URL:

    The URL to open.

  • completionHandler:

    A block/closure to be called when the URL has opened. The closure takes a single boolean parameter indicating whether the operation was successful.

Discussion

Each extension point determines whether to support this method, or under which conditions to support this method. In iOS, the Today and iMessage app extension points support this method. An iMessage app extension can use this method only to open its parent app, and only if the parent app is shown on the iOS home screen.