Created
August 29, 2017 18:11
-
-
Save automactic/9031785d77ac8b81ca78b8bb57fcf822 to your computer and use it in GitHub Desktop.
macOS configSearchMenu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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