I'm developing an app for macOS in Swift. The view I'm designing has the standard "traffic lights" disabled and a transparent full size content title bar. I need to design a new custom traffic light to quit the app and one to minimize the window. I've already found out how to make a custom quit button but I can't manage to create a custom minimize button. I'm new to macOS programming so for sure I'm doing something wrong.
This is the code that I'm trying to use but that does not work:
@IBAction func miniApp(_ sender: Any) {
NSWindow.miniaturize(self)
}
I'm using Swift 4
I can't figure out the right way to do this. Thank you in advance
You need to send that action to current window. If this action is in your view controller then it should be
@IBAction func miniApp(_ sender: Any) {
self.view.window.miniaturize(self)
}