Reputation: 49
I'm building a Finder extension for OSX, I want to add a separator to the contextMenu of Finder, but I can't see the separator line:
The separator I want to add is like this:
Here is the related code:
let main = NSMenu()
let submenu = NSMenu()
let mainDropdown = NSMenuItem(
title: "Extension menu",
action: nil,
keyEquivalent: "")
main.addItem(mainDropdown)
main.setSubmenu(submenu, for: mainDropdown)
let all = NSMenuItem(title: "All",
action: nil,
keyEquivalent: "")
all.isEnabled = false
submenu.addItem(all)
submenu.addItem(.separator())
I found this:
"This menu item is disabled. The default separator item is blank space." at https://developer.apple.com/documentation/appkit/nsmenuitem/1514838-separator
So what's the correct way to add a separator with the line?
Upvotes: 2
Views: 258