This is a Swift port of the original "CustomMenus" Objective-C sample project from Apple. It demonstrates a custom search completions popup window, and also demonstrates a popup menu with a custom view.
https://developer.apple.com/library/content/samplecode/CustomMenus