---
title: UIMenuSystem
framework: uikit
role: symbol
role_heading: Class
path: uikit/uimenusystem
---

# UIMenuSystem

An object representing a main or contextual menu system.

## Declaration

```swift
@MainActor class UIMenuSystem
```

## Overview

Overview A menu system groups root menus together. The main system has only one root menu while the context system can have multiple root menus, each built in different UIResponder objects like a view controller. Use UIMenuSystem in your implementation of buildMenu(with:) to isolate changes to a specific system. override func buildMenu(with builder: UIMenuBuilder) {     super.buildMenu(with: builder)          // Ensure that the builder is modifying the menu bar system.     guard builder.system == UIMenuSystem.main else { return }

// ... } You can also use a menu system to rebuild or revalidate menus as changes occur in your app. To rebuild a menu, call the setNeedsRebuild() method. Call setNeedsRevalidate() when you need the menu system to revalidate a menu. For more information, see Adding menus and shortcuts to the menu bar and user interface.

## Topics

### Getting a menu system

- [main](uikit/uimenusystem/main.md)
- [context](uikit/uimenusystem/context.md)

### Rebuilding a menu system

- [setNeedsRebuild()](uikit/uimenusystem/setneedsrebuild().md)

### Revalidating a menu system

- [setNeedsRevalidate()](uikit/uimenusystem/setneedsrevalidate().md)

### Setting group preferences

- [UIMenuSystem.ElementGroupPreference](uikit/uimenusystem/elementgrouppreference.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [UIContextMenuSystem](uikit/uicontextmenusystem.md)
- [UIMainMenuSystem](uikit/uimainmenusystem.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)

## See Also

### App menus

- [UIMenu](uikit/uimenu.md)
- [UIMenuBuilder](uikit/uimenubuilder.md)
- [UIMainMenuSystem](uikit/uimainmenusystem.md)
