To make the title bar transparent in a UIWindowScene for Mac Catalyst, you can try the following approach. You'll need to access the NSWindow via the UIWindowScene and set its appearance properties directly, since Mac Catalyst allows you to interact with the AppKit layer.
Here’s how you can do it:
if let titlebar = windowScene.titlebar {
titlebar.titleVisibility = .hidden
titlebar.toolbar = nil
// Access the NSWindow
if let nsWindow = windowScene.value(forKey: "nsWindow") as? NSObject {
nsWindow.setValue(true, forKey: "titlebarAppearsTransparent")
nsWindow.setValue(false, forKey: "showsToolbarButton")
nsWindow.setValue(0, forKey: "styleMask") // Removes any existing window decorations
}
}
This code snippet hides the toolbar and ensures the title bar is transparent by modifying the NSWindow properties. You need to ensure that you're interacting with the correct layer of the window system for this to work on Mac Catalyst.