Customize About panel on macOS in SwiftUI

On macOS we get a default About panel without needing to do any extra work, it will be available via the app menu.

Screenshot of the default About pannel on macOS

The parts that we can customize are app name and icon, version, credits and copyright. There are a few different ways to customize what is shown in our app's about window. We can either add files with specific names to our app bundle and special keys to our Info.plist that will automatically be read, or we can create the About panel in code and pass it a list of options.

Swift Gems by Natalia Panferova book coverSwift Gems by Natalia Panferova book cover

Level up your Swift skills!$35

100+ tips to take your Swift code to the next level

Swift Gemsby Natalia Panferova

  • Advanced Swift techniques for experienced developers bypassing basic tutorials
  • Curated, actionable tips ready for immediate integration into any Swift project
  • Strategies to improve code quality, structure, and performance across all platforms

Level up your Swift skills!

100+ tips to take your Swift code to the next level

Swift Gems by Natalia Panferova book coverSwift Gems by Natalia Panferova book cover

Swift Gems

by Natalia Panferova

$35

# Create About panel in code

When we use the SwiftUI app lifecycle to create macOS apps, we can define menu items using commands(content:) method. To add custom options to the About panel we have to override the provided About menu item.

@main
struct MyGreatAppApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
        .commands {
            CommandGroup(replacing: .appInfo) {
                Button("About MyGreatApp") {
                    NSApplication.shared.orderFrontStandardAboutPanel(
                        options: [
                            NSApplication.AboutPanelOptionKey.credits: NSAttributedString(
                                string: "Some custom info about my app.",
                                attributes: [
                                    NSAttributedString.Key.font: NSFont.boldSystemFont(
                                        ofSize: NSFont.smallSystemFontSize)
                                ]
                            ),
                            NSApplication.AboutPanelOptionKey(
                                rawValue: "Copyright"
                            ): "© 2020 NATALIA PANFEROVA"
                        ]
                    )
                }
            }
        }
    }
}

Inside the button action we are calling AppKit method for presenting the About panel orderFrontStandardAboutPanel(options:) and passing it some custom options. The list of predefined keys that we can use is available from Apple documentation on NSApplication.AboutPanelOptionKey.

In our example we first add credits which can show the additional information about our app. It's an NSAttributedString, we can control its appearance by specifying various attributes such as font in our case.

In addition to predefined keys it's also possible to add copyright information by creating an AboutPanelOptionKey with the rawValue of Copyright.

We can see that our custom information is now reflected in the About panel of the app.

Screenshot of the About pannel with app description and copyright

# Add information in files and plist properties

It's also possible to customize the About panel by adding files to our app bundle. You can check how exactly to name the files in Apple documentation for each AboutPanelOptionKey.

For example, to add credits we have to have a file that's named Credits.html, Credits.rtf or Credits.rtfd.

To provide copyright information we need to add NSHumanReadableCopyright to Info.plist file.

Screenshot of Info.plist file in Xcode
Integrating SwiftUI into UIKit Apps by Natalia Panferova book coverIntegrating SwiftUI into UIKit Apps by Natalia Panferova book cover

Enhance older apps with SwiftUI!$45

A detailed guide on gradually adopting SwiftUI in UIKit projects

Updated for iOS 18 and Xcode 16!

Integrating SwiftUI into UIKit Appsby Natalia Panferova

  • Upgrade your apps with new features like Swift Charts and Widgets
  • Support older iOS versions with effective backward-compatible strategies
  • Seamlessly bridge state and data between UIKit and SwiftUI using the latest APIs

Enhance older apps with SwiftUI!

A detailed guide on gradually adopting SwiftUI in UIKit projects

Integrating SwiftUI into UIKit Apps by Natalia Panferova book coverIntegrating SwiftUI into UIKit Apps by Natalia Panferova book cover

Integrating SwiftUI
into UIKit Apps

by Natalia Panferova

Updated for iOS 18 and Xcode 16!

$45