---
title: Commands
framework: swiftui
role: symbol
role_heading: Protocol
path: swiftui/commands
---

# Commands

Conforming types represent a group of related commands that can be exposed to the user via the main menu on macOS and key commands on iOS.

## Declaration

```swift
@MainActor @preconcurrency protocol Commands
```

## Mentioned in

Building and customizing the menu bar with SwiftUI

## Overview

Overview A type conforming to this protocol inherits @preconcurrency @MainActor isolation from the protocol if the conformance is included in the type’s base declaration: struct MyCustomType: Transition {     // `@preconcurrency @MainActor` isolation by default } Isolation to the main actor is the default, but it’s not required. Declare the conformance in an extension to opt out of main actor isolation: extension MyCustomType: Transition {     // `nonisolated` by default }

## Topics

### Implementing commands

- [body](swiftui/commands/body-swift.property.md)
- [Body](swiftui/commands/body-swift.associatedtype.md)

## Relationships

### Conforming Types

- [CommandGroup](swiftui/commandgroup.md)
- [CommandMenu](swiftui/commandmenu.md)
- [EmptyCommands](swiftui/emptycommands.md)
- [EmptyView](swiftui/emptyview.md)
- [Group](swiftui/group.md)
- [ImportFromDevicesCommands](swiftui/importfromdevicescommands.md)
- [InspectorCommands](swiftui/inspectorcommands.md)
- [SidebarCommands](swiftui/sidebarcommands.md)
- [TextEditingCommands](swiftui/texteditingcommands.md)
- [TextFormattingCommands](swiftui/textformattingcommands.md)
- [ToolbarCommands](swiftui/toolbarcommands.md)
- [TupleContent](swiftui/tuplecontent.md)

## See Also

### Defining commands

- [commands(content:)](swiftui/scene/commands(content:).md)
- [commandsRemoved()](swiftui/scene/commandsremoved().md)
- [commandsReplaced(content:)](swiftui/scene/commandsreplaced(content:).md)
- [CommandMenu](swiftui/commandmenu.md)
- [CommandGroup](swiftui/commandgroup.md)
- [CommandsBuilder](swiftui/commandsbuilder.md)
- [CommandGroupPlacement](swiftui/commandgroupplacement.md)
