Instance Method

application(_:open:)

Declaration

optional func application(_ application: NSApplication, open urls: [URL])

Parameters

application

Your singleton app object.

urls

An array of URLs to open. The list does not include URLs for which your app has a defined document type.

Discussion

AppKit calls this method when your app is asked to open one or more URL-based resources. You must declare the URL types that your app supports in your Info.plist file using the CFBundleURLTypes key. The list can also include URLs for documents for which your app does not have an associated NSDocument class. You configure document types using Xcode, or by adding the CFBundleDocumentTypes key to your Info.plist file.

If your delegate implements this method, AppKit does not call the application(_:openFile:) or application(_:openFiles:) methods.

See Also

Opening Files

func application(NSApplication, openFile: String) -> Bool

Tells the delegate to open a single file.

func application(Any, openFileWithoutUI: String) -> Bool

Tells the delegate to open a file programmatically.

func application(NSApplication, openTempFile: String) -> Bool

Tells the delegate to open a temporary file.

func application(NSApplication, openFiles: [String])

Tells the delegate to open multiple files.

func applicationOpenUntitledFile(NSApplication) -> Bool

Tells the delegate to open an untitled file.

func applicationShouldOpenUntitledFile(NSApplication) -> Bool

Invoked immediately before opening an untitled file.