I'm working on a status bar app in Swift. I tried to hide the window by adding Application is agent (UIElement) item and set it to YES, but it just doesn't work - it always shows the window and the menu bar.
My storyboard:

Info.plist:

What can I do ?
The option for "Target -> Info -> Curstom macOS Appli.. : Application is agent (UIElement)" only hide the App from Dock
To hide the window on SwiftUI you need to change your App Scene:
var body: some Scene {
Settings{
EmptyView()
}
}
Alternatively you can change the ApplicationDelegate
func applicationDidFinishLaunching(_ notification: Notification) {
if let window = NSApplication.shared.windows.first {
window.close()
}
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With