Contents

Menus and commands

Provide space-efficient, context-dependent access to commands and controls.

Overview

Use a menu to provide people with easy access to common commands. You can add items to a macOS or iPadOS app’s menu bar using the commands(content:) scene modifier, or create context menus that people reveal near their current task using the contextMenu(menuItems:) view modifier.

[Image]

Create submenus by nesting Menu instances inside others. Use a Divider view to create a separator between menu elements.

For design guidance, see Menus in the Human Interface Guidelines.

Topics

Building a menu bar

Creating a menu

Creating context menus

Defining commands

Getting built-in command groups

Showing a menu indicator

Configuring menu dismissal

Setting a preferred order

Deprecated types

See Also

Views