Search code examples
macoscocoansapplication

Open About App window programmatically on macOS


On Mac OS X, every app has an "About" window, which can be opened by clicking About [appname] in the [appname] menu in the menu bar.

I'd like to open this window programmatically. Is this possible?

EG: The About button for iTunes:

iTunes About Menu Item


Solution

  • The About menu item is connected to the orderFrontStandardAboutPanel method of NSApplication, you can call it programmatically with

    [NSApp orderFrontStandardAboutPanel:self]; // or nil as parameter
    

    or in Swift

    NSApp.orderFrontStandardAboutPanel(self) // or nil as parameter