I created a HelloWorld macOS SwiftUI project and I am seeing the option of EnterFullScreen in View menu, so how can I remove this option and disable it from bace in SwiftUI?
@main
struct testApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
You can change this using UserDefaults
by setting the key "NSFullScreenMenuItemEverywhere" to false as in this answer but if you do it in applicationWillFinishLaunching
as in that answer it will be too late to take effect so move it to the init()
in your App struct
init() {
UserDefaults.standard.set(false, forKey: "NSFullScreenMenuItemEverywhere")
}
If you rather use the AppStorage property wrapper for this it could look like this
@AppStorage("NSFullScreenMenuItemEverywhere") var fullScreenEnabled = false
init() {
fullScreenEnabled = false
}
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