I recently implemented a search suggestions menu on macOS for Unread.
Even though Safari, Mail, and Finder implement search suggestion menus, there is no standard AppKit mechanism for providing them in AppKit. Popping up an
NSMenu does not work because the search field cannot receive keystrokes while the menu is displayed.
Interestingly there is a good mechanism for providing search suggestion menus in SwiftUI, but incorporating that mechanism into an AppKit-based application looks much more difficult than just using an
With that as a base, I updated it to support things like dark mode. I also made it a little more focused on search suggestion menus, as opposed to custom menus in general.
The result is a sample project on GitHub. I hope you find it useful.
Thank you to: