mhdhejazi / Dynamic

Call hidden/private API in style! The Swift way.

Home Page:https://medium.com/@mhdhejazi/calling-ios-and-macos-hidden-api-in-style-1a924f244ad1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hide close/minimize/maximize button in NSWindow

tommycarpi opened this issue · comments

I've been trying to remove/hide the 3 top-left buttons of the view (close, minimize and maximize, but I stuck.

This is my current code, not working ...

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
#if targetEnvironment(macCatalyst)
    Dynamic(self.view.window?.nsWindow).standardWindowButton(0).isHidden = true
    Dynamic(self.view.window?.nsWindow).standardWindowButton(1).isHidden = true
    Dynamic(self.view.window?.nsWindow).standardWindowButton(2).isHidden = true
#endif
}

Did anyone manage to solve this?

You can achieve this over a NSWindow setting the style mask https://developer.apple.com/documentation/appkit/nswindow/stylemask