macosswiftui

SwiftUI - How to hide window title on macOS


On macOS with new SwiftUI framework without AppDelegate / SceneDelegate, how do I hide the window title?

I found this article from Apple that describes how to do it for a Catalyst app but without that delegate now, how do I achieve this?

Link to article - https://developer.apple.com/documentation/uikit/mac_catalyst/removing_the_title_bar_in_your_mac_app_built_with_mac_catalyst

enter image description here


Solution

  • You need to use the following window style:

    WindowGroup {
        ContentView()
    }
    .windowStyle(HiddenTitleBarWindowStyle())