<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSMenuDelegate/menuWillOpen(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSMenuDelegate(im)menuWillOpen:"
  },
  "title" : "menuWillOpen(_:)"
}
-->

# menuWillOpen(_:)

Invoked when a menu is about to open.

```
@MainActor optional func menuWillOpen(_ menu: NSMenu)
```

## Parameters

`menu`

The menu that is about to open.

## Discussion

Don’t modify the structure of the menu or the menu items during this method.

---

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)