NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

Mac Catalyst

Forums > SwiftUI

In a Mac Catalyst app, there is a titlebar at the top, which just looks odd. Is there anyway in SwiftUI to get rid of the titlebar?


Yes, in SwiftUI, you can remove the title bar from a Mac Catalyst app by setting the window style to .hiddenTitleBar.

Here is an example of how you can do this:

import SwiftUI

@main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() .frame(minWidth: 300, minHeight: 200) .windowStyle(.hiddenTitleBar) // Set the window style to hiddenTitleBar } .windowToolbarStyle(.unifiedCompact) // Optional: set the window toolbar style } }

struct ContentView: View { var body: some View { Text("Hello, world!") .padding() } }

In this example, the WindowGroup contains a ContentView with some text. We set the windowStyle to .hiddenTitleBar to remove the title bar from the app window.

Note that the .hiddenTitleBar style also removes the default close, minimize, and fullscreen buttons from the window. If you still want those buttons, you can use the .titleBar style instead and customize it to your liking.



That doesn't seem to work. I am told that .windowStyle is not available in an iOS app. If I forgot to mention which I think I did. I am adding to my iOS app a supported destination of Mac Catalyst until I can write a proper macOS target.


Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until October 1st.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.