显示默认的关于对话框

showing the default about dialog

大多数 Cocoa 应用都带有 "About App" 菜单项。这将打开一个对话框,该对话框通常不是自定义的,而是提供的。它显示应用程序包中的图标和一些信息。

我似乎找不到任何关于如何在代码中打开此对话框的 information/documentation。

我有一个用 swift 编写的应用程序,它不使用 xib/storyboards,所以没有默认的 "About" 菜单项。虽然编写自定义的并不难,但我仍然想知道如何打开标准的。

是否有指向文档或代码片段的指针?我没找到。

在应用程序实例上调用 orderFrontStandardAboutPanel(_:)

NSApp.orderFrontStandardAboutPanel(nil)