<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/CommandGroup",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI12CommandGroupV"
  },
  "title" : "CommandGroup"
}
-->

# CommandGroup

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

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

## 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:)`](/documentation/SwiftUI/CommandGroup/init(after:addition:))

A value describing the addition of the given views to the end of the
indicated group.

[`init(before:addition:)`](/documentation/SwiftUI/CommandGroup/init(before:addition:))

A value describing the addition of the given views to the beginning of
the indicated group.

[`init(replacing:addition:)`](/documentation/SwiftUI/CommandGroup/init(replacing:addition:))

A value describing the complete replacement of the contents of the
indicated group with the given views.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)