Reputation: 331
I am writing a macOS Cocoa application with Swift and I don't know how to prevent, that the main window shows up on application startup. I want to check first, if there is a new version available on the server: if there is one, a spash screen should appear. I don't know how to accomplish this and couldn't find good information too. I also don't know how to get rid of the windows standard buttons like for closing the window. Any help?
Upvotes: 0
Views: 1912
Reputation: 4710
Check settings of your main window in Xcode. There are some checkboxes which control window buttons and other settings in Attributes inspector.
You can disable or enable them programmatically when you accessing Window object.
For example you can implement this approach in WindowController like this:
class WindowController: NSWindowController {
override func windowDidLoad() {
super.windowDidLoad()
window!.styleMask &= ~NSClosableWindowMask
}
}
Previously you need to add your custom WindowController class to window controller object in storyboard (Identity inspector tab).
Upvotes: 1