Instance Method

open(_:options:completionHandler:)

Attempts to open the resource at the specified URL asynchronously.

Declaration

func open(_ url: URL, options: UIScene.OpenExternalURLOptions?, completionHandler completion: ((Bool) -> Void)? = nil)

Parameters

url

A URL (Universal Resource Locator). The resource identified by this URL may be local to the current app or handled by a different app. UIKit supports many common schemes, including the http, https, tel, facetime, and mailto schemes.

options

The options to use when opening the URL.

completion

The block to execute with the results. Provide a value for this parameter if you want to be informed of the success or failure of opening the URL. This block is executed asynchronously on your app's main thread. The block has no return value and takes the following parameter:

success

A Boolean value indicating whether the system successfully opened the URL. If no app is capable of handling the specified URL, this parameter is false.

Discussion

Use this method to open the specified resource. If the specified URL scheme is handled by another app, iOS launches that app and passes the URL to it. Launching the app brings the other app to the foreground.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software