menuNeedsUpdate
menuNeedsUpdate is a delegate method of the NSMenuDelegate protocol in macOS AppKit. It is invoked just before a menu is shown, giving the delegate an opportunity to refresh or rebuild the menu’s items. This is especially useful for dynamic or context-sensitive menus whose contents depend on the current state of the application, such as a Recent Files submenu, a list of open documents, or actions that vary with context.
Implementation typically involves the menu’s delegate clearing existing items and repopulating the menu with up-to-date choices.
Because this callback is part of the UI update cycle, these updates should be performed on the
Relation to other mechanisms: menuNeedsUpdate is a delegate callback rather than a notification. It is specifically