A macOS SwiftUI app called "Writer" that has a hidden title bar mode. The app needed to eliminate all visual artifacts when the title bar is hidden, including a persistent gray line separator.
- ✅ White title bar area is properly suppressed
- ✅ Gray line separator completely eliminated
- ✅ Perfect hidden title bar mode achieved
- ✅ Clean, maintainable implementation
The key breakthrough was using window.titlebarSeparatorStyle = .none (macOS 12+)
This property directly controls the title bar separator line that appears between the title bar and content area - exactly what was causing the gray line issue.
- Perfect hidden title bar mode - no visual artifacts at all
- Hover-to-reveal functionality - 50px band at top reveals title bar on hover
- ⌘T hotkey toggle - switches between hidden/visible title bar modes
- Clean code - removed all aggressive/nuclear approaches after finding the proper solution
- App: macOS SwiftUI app with NSWindow manipulation
- Architecture: Uses WindowController.swift with NSWindowDelegate + ContentView.swift
- Final Implementation: Clean approach using proper NSWindow properties
- Target: macOS 14 (Sonoma) compatibility, with macOS 12+ for separator control
// The key fix: Disable title bar separator (macOS 12+)
if #available(macOS 12.0, *) {
window.titlebarSeparatorStyle = titleBarHidden ? .none : .automatic
}/Users/andreas/Coding/Writer/Writer/WindowController.swift- Clean title bar suppression logic/Users/andreas/Coding/Writer/Writer/ContentView.swift- UI and event handling
The final implementation uses:
- Targeted title bar view suppression (not aggressive)
- Proper NSWindow configuration with fullSizeContentView
titlebarSeparatorStyle = .nonefor gray line elimination- Comprehensive logging for debugging
- Clean, maintainable code without nuclear approaches