简体   繁体   中英

How can I make a window take over the entire screen? MacOS SwiftUI

How can I make a window that is the fullscreen of the MacOS screen that goes over the menuBar, and goes over the applications at the bottom. I saw functions like 'setMenuBarVisible'; however this does not work in SwiftUI. Any help would be appreciated

This code will make your app toggle fullscreen on launch.

        WindowGroup {
            ContentView()
                .onAppear {
                    DispatchQueue.main.async {
                        if let window = NSApplication.shared.windows.last {
                            window.toggleFullScreen(nil)
                        }
                    }
                }
            }

I'm not sure if this is the answer you are looking for but.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM