When I tried to create the bug in new project, I found the solution..
First, I added ".windowStyle(.hiddenTitleBar)" to the WindowGroup in my main app file. It prepares the window to be "borderless" before the system even draws it.
Standard applicationDidFinishLaunching logic was running too early for me. The OS was still setting up its default gray style and overwriting my code. I used a tiny timer to "force" my settings once the window is actually alive.
func applicationDidFinishLaunching(_ notification: Notification) {
// I used a 0.1s timer to catch the window AFTER the OS finishes its default setup
Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in
if let window = NSApplication.shared.windows.first {
self.setupWindow(window)
timer.invalidate()
}
}
}
Then re-apply the transparency and separator settings in the windowDidBecomeKey delegate method to stop the "focus pop."
func windowDidBecomeKey(_ notification: Notification) {
guard let window = notification.object as? NSWindow else { return }
window.titlebarAppearsTransparent = true
window.titlebarSeparatorStyle = .none
window.backgroundColor = .black
}
Topic:
UI Frameworks
SubTopic:
General