Skip to content

Instantly share code, notes, and snippets.

Created August 29, 2017 18:11
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
macOS configSearchMenu
func configSearchMenu() {
let clear = NSMenuItem(title: "Clear", action: nil, keyEquivalent: "")
clear.tag = Int(NSSearchFieldClearRecentsMenuItemTag)
searchMenu.insertItem(clear, at: 0)
searchMenu.insertItem(NSMenuItem.separator(), at: 0)
let recents = NSMenuItem(title: "", action: nil, keyEquivalent: "")
recents.tag = Int(NSSearchFieldRecentsMenuItemTag)
searchMenu.insertItem(recents, at: 0)
let recentHeader = NSMenuItem(title: "Recent Search", action: nil, keyEquivalent: "")
recentHeader.tag = Int(NSSearchFieldRecentsTitleMenuItemTag)
searchMenu.insertItem(recentHeader, at: 0)
let noRecent = NSMenuItem(title: "No Recent Search", action: nil, keyEquivalent: "")
noRecent.tag = Int(NSSearchFieldNoRecentsMenuItemTag)
searchMenu.insertItem(noRecent, at: 0)
searchField.searchMenuTemplate = searchMenu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment