TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

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 String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

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

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.