You cannot remove the app title menu on the bar, but the following will work to remove all of the commands under it. First, add the following line of code to your App struct
:
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
Then, create a new file called AppDelegate (or whatever you will remember - this can also be in the same file). Create an AppDelegate
:
//In the file, you must import `AppKit`
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationWillFinishLaunching(_ notification: Notification) {
NSWindow.allowsAutomaticWindowTabbing = false //<-- This is the key!
//This will hide all of the fullscreen and tab menu controls
}
}
This code was tested with Xcode 14 and macOS 13.
References
https://www.hackingwithswift.com/forums/swiftui/what-s-the-swiftui-way-to-do-this-appdelegate-thing/10559
https://stackoverflow.com/a/65634944/20384561
https://developer.apple.com/documentation/appkit/nswindow/1646657-allowsautomaticwindowtabbing