Post

Replies

Boosts

Views

Activity

Reply to How to remove unused Help menu item from SwiftUI app
I also wanted to throw in my two cents on this topic. I currently am developing a SwiftUI based Mac app that does not use Catalyst so UIMenuBuilder is not an option. My solution was to create a new MainMenu.xib file (which would allow me to graphically manage the menu bar) and link it up by creating a NSApplicationDelegate in my application's main SwiftUI file. Within my newly created AppDelegate I pointed it towards the MainMenu.xib file that I had previously created. Here is my example: import SwiftUI @main struct SidebarApp: App {     @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate     var body: some Scene {         WindowGroup {             ContentView()         }     } } class AppDelegate: NSObject, NSApplicationDelegate {     @IBOutlet var window: NSWindow!     func applicationDidFinishLaunching(_ aNotification: Notification) {         let nib = NSNib(nibNamed: NSNib.Name("MainMenu"), bundle: Bundle.main)         nib?.instantiate(withOwner: NSApplication.shared, topLevelObjects: nil)     }     func applicationWillTerminate(_ aNotification: Notification) {       } } Once this is setup I was able to add/remove any Menu Bar item in a graphical way from the xib file. It is worth noting that this will override any Menu Bar items that were declared within the application itself. For me this was not too big of a deal as I would gladly recreate these items if it allowed me to simply remove the Help menu...
Sep ’20