ControlGroup in context menus in SwiftUI
Starting from iOS 17 and iPadOS 17 we can now use a ControlGroup inside a contextMenu(), enabling more compact access to common actions.

ContentView()
.contextMenu {
ControlGroup {
Button {
// cut action
} label: {
Label("Cut", systemImage: "scissors")
}
Button {
// copy action
} label: {
Label("Copy", systemImage: "doc.on.doc")
}
Button {
// paste action
} label: {
Label("Paste", systemImage: "doc.on.clipboard")
}
}
Button(role: .destructive) {
// delete action
} label: {
Label("Delete", systemImage: "trash")
}
}
On macOS this code creates a nested sub-menu with cut, copy and paste as items.


Check out our book!
Integrating SwiftUI into UIKit Apps
Integrating SwiftUI intoUIKit Apps
UPDATED FOR iOS 17!
A detailed guide on gradually adopting SwiftUI in UIKit projects.
- Discover various ways to add SwiftUI views to existing UIKit projects
- Use Xcode previews when designing and building UI
- Update your UIKit apps with new features such as Swift Charts and Lock Screen widgets
- Migrate larger parts of your apps to SwiftUI while reusing views and controllers built in UIKit