how can i make a menubar application on mac

Asked on 06/18/2025

1 search

To create a menu bar application on macOS, you can use AppKit or SwiftUI, depending on your preference and the specific requirements of your app. Here are some key points and resources from WWDC sessions that might help you:

  1. AppKit and SwiftUI Integration: You can use SwiftUI menus in AppKit contexts using NSHostingMenu, which is a new NSMenu subclass. This allows you to share menu definitions between parts of your app that use AppKit and those that use SwiftUI. You can create your menu definition using a SwiftUI view in the body. What’s new in AppKit (06:41).

  2. Building Menus with SwiftUI: SwiftUI provides a convenient way to define menus using its declarative syntax. You can use SwiftUI views to describe the data relationship, such as using a toggle to switch a value on and off, a picker to select one value from a list, and a button to perform an action.

  3. Menu Bar Design: When designing a menu bar, it's important to organize your menu items by frequency of use rather than alphabetically. Group related actions into their own sections to create further separation. Avoid hiding menus and menu items to ensure a predictable user experience. Elevate the design of your iPad app (10:24).

  4. UIKit Menu Bar: If you're developing for iOS as well, note that iOS 26 brings the menu bar from macOS to iPad, providing a consistent experience across platforms. This can be useful if you're planning to have a cross-platform app. What’s new in UIKit (03:21).

These resources should give you a good starting point for creating a menu bar application on macOS. If you need more detailed guidance, consider watching the full sessions mentioned above for comprehensive insights.