Hello. I'm new to Swift and am attempting to create a menu item on the menu bar that will open a URL in the default browser. When I run this code, I get the error message "NSMenu has no member URL" but I'm not sure what I'm doing wrong.
func setupMenus() { let menu = NSMenu() _ = URL(string: "https://www.example.com") menu.addItem(NSMenuItem.separator()) if #available(macOS 12.0, *) { menu.addItem(NSMenuItem(title: "Example", action: #selector(NSMenu.URL), keyEquivalent: "")) } else { // Fallback on earlier versions } statusItem.menu = menu }