open(_:configuration:completionHandler:)
Opens a URL asynchronously using the provided options.
Declaration
func open(_ url: URL, configuration: NSWorkspace.OpenConfiguration, completionHandler: (@Sendable (NSRunningApplication?, (any Error)?) -> Void)? = nil)func open(_ url: URL, configuration: NSWorkspace.OpenConfiguration) async throws -> NSRunningApplicationParameters
- url:
The URL to open.
- configuration:
The options that indicate how you want to open the URL.
- completionHandler:
The completion handler block to call asynchronously with the results. AppKit executes the completion handler on a concurrent queue. The handler block has no return value and takes the following parameters:
- app
On success, this parameter contains a reference to the app that opened the URL. If the app didn’t open the URL successfully, this parameter is
nil.- error
On failure, this parameter contains an Nserror object indicating the reason for the failure. If the method opened the URL successfully, this parameter is
nil.
Discussion
You may call this method safely from any thread of your app.