I'm currently developing a SwiftUI desktop application and I'm facing an issue with window customization. I want to entirely remove the title bar from my application's window - this includes the traffic lights (close, minimize, maximize buttons) and the title.
Here is a simplified version of my current SwiftUI application structure:
@main
struct MyApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
MainView()
}.windowStyle(HiddenTitleBarWindowStyle())
.commands {
CommandGroup(replacing: .windowArrangement) { }
}
}
}
In MyApp, I'm using HiddenTitleBarWindowStyle(), but it's not giving me the expected result. The application's window still has the title bar with traffic lights and title visible.
I'm aware that customization of the NSWindow instance could allow me to control the window's appearance, but it's unclear to me how to do that in the context of a SwiftUI application that starts from the @main struct.
Can anyone guide me on how to completely remove the title bar in my SwiftUI desktop application?
Thanks in advance.