Contents

application(_:openFile:)

Returns a Boolean value that indicates if the app opens the specified file.

Declaration

@MainActor optional func application(_ sender: NSApplication, openFile filename: String) -> Bool

Parameters

  • sender:

    The application object associated with the delegate.

  • filename:

    The name of the file to open.

Return Value

true if the file was successfully opened or false if it was not.

Discussion

Sent directly by theApplication to the delegate. The method should open the file filename, returning true if the file is successfully opened, and false otherwise. If the user started up the application by double-clicking a file, the delegate receives the application(_:openFile:) message before receiving applicationDidFinishLaunching(_:). (applicationWillFinishLaunching(_:) is sent before application(_:openFile:).)

See Also

Opening Files