how to create apps on toolbar macos

Asked on 09/07/2024

1 search

To create apps with toolbars on macOS, you can utilize the enhancements to NSToolbar as discussed in the session titled "What’s new in AppKit" at WWDC 2024. Here are some key points to consider:

  1. Display Modes: NSToolbar now supports displaying items with and without text labels. This allows you to offer users a choice of style, even if the toolbar contents aren't customizable. You can enable this feature using the allowsDisplayModeCustomization property, which is enabled by default. Ensure your toolbar has an identifier so that AppKit can save the style preference.

  2. Item Identifiers: You can use the new itemIdentifiers property to set a toolbar's item identifiers automatically, which provides a convenience over the existing items property.

  3. SwiftUI Integration: You can incrementally adopt SwiftUI with new menu and animation APIs, which can be integrated into your toolbar design.

For more detailed guidance, you can refer to the session What’s new in AppKit (15:21) where toolbar refinements are discussed.