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.