---
title: CommandGroup
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/commandgroup
---

# CommandGroup

Groups of controls that you can add to existing command menus.

## Declaration

```swift
nonisolated struct CommandGroup<Content> where Content : View
```

## Mentioned in

Building and customizing the menu bar with SwiftUI

## Overview

Overview In macOS, SwiftUI realizes command groups as collections of menu items in a menu bar menu. In iOS, iPadOS, and tvOS, SwiftUI creates key commands for each of a group’s commands that has a keyboard shortcut.

## Topics

### Creating a command group

- [init(after:addition:)](swiftui/commandgroup/init(after:addition:).md)
- [init(before:addition:)](swiftui/commandgroup/init(before:addition:).md)
- [init(replacing:addition:)](swiftui/commandgroup/init(replacing:addition:).md)

## Relationships

### Conforms To

- [Commands](swiftui/commands.md)

## See Also

### Defining commands

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