5

I need to remove this option in my app

This is my app delegate:

import AppKit
public class AppDelegate: NSObject, NSApplicationDelegate {
    public func applicationWillTerminate(_ aNotification: Notification) {
        MainViewModel.shared.saveSettings()
    }
    public func applicationDidFinishLaunching(_ notification: Notification) {
        for window in NSApp.windows {
            var style = window.styleMask
            style.remove(.resizable)
            window.styleMask = style
            window.standardWindowButton(.zoomButton)?.isHidden = true
        }
    }
    public func applicationWillFinishLaunching(_ notification: Notification) {
        NSWindow.allowsAutomaticWindowTabbing = false
    }
}

How can i do this?

1
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Commented Dec 20, 2021 at 17:21

1 Answer 1

11

Just add the commands modifier to WindowGroup, as here:

WindowGroup {
            MainView().frame(width: 300, height: 95)
        }.commands {
            CommandGroup(replacing: CommandGroupPlacement.newItem) {
            }
        }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.