EssExx
EssExx

Reputation: 49

NSMenuItem.separator() is a blank space rather than a line

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:

enter image description here

The separator I want to add is like this:

enter image description here

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

Answers (0)

Related Questions