How use Menu
Asked on 04/10/2025
1 search
To use menus in your app, you can leverage the new capabilities introduced in the WWDC sessions. Specifically, in the session titled "What’s new in AppKit," there are several enhancements related to menu usage:
-
SwiftUI Menus in AppKit: You can now use SwiftUI menus within AppKit contexts using
NSHostingMenu
, a newNSMenu
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 and use it in any AppKit context that accepts anNSMenu
. This is covered in the session What’s new in AppKit (06:21). -
Context Menu Positioning: In macOS Sequoia, you can use the keyboard to open a context menu for the currently focused UI element. The default shortcut is Control + Return, but it can be customized. The menu is positioned automatically over the view's bounds if your view has a value for the menu property. This is discussed in the session What’s new in AppKit (08:44).
-
Menu Actions in UIKit: Menu actions provide all of an app's commands in the macOS menu bar and in the iPadOS and visionOS keyboard shortcut menus. iOS 18 makes menu actions more useful for iPhone-only apps. This is detailed in the session What’s new in UIKit (18:14).
These enhancements make it easier to integrate and manage menus across different Apple platforms, providing a more cohesive user experience.

What’s new in UIKit
Explore everything new in UIKit, including tab and document launch experiences, transitions, and text and input changes. We’ll also discuss better-than-ever interoperability between UIKit and SwiftUI animations and gestures, as well as general improvements throughout UIKit.

What’s new in AppKit
Discover the latest advances in Mac app development. Get an overview of the new features in macOS Sequoia, and how to adopt them in your app. Explore new ways to integrate your existing code with SwiftUI. Learn about the improvements made to numerous AppKit controls, like toolbars, menus, text input, and more.

What’s new in SwiftUI
Learn how you can use SwiftUI to build great apps for any Apple platform. Explore a fresh new look and feel for tabs and documents on iPadOS. Improve your window management with new windowing APIs, and gain more control over immersive spaces and volumes in your visionOS apps. We’ll also take you through other exciting refinements that help you make expressive charts, customize and layout text, and so much more.