Launching black screen appear : Mac OS app

Viewed 5489

I want to launch my mac app in full screen and hide the menu and doc so the user can not switch the app or can see another app. so I used the below code to launch windows in full screen.

override func viewDidAppear() {
      super.viewDidAppear()
            let presOptions: NSApplication.PresentationOptions = [.hideDock, .fullScreen]

            let optionsDictionary = [NSView.FullScreenModeOptionKey.fullScreenModeApplicationPresentationOptions :
                                        NSNumber(value: presOptions.rawValue)]

            self.view.enterFullScreenMode(NSScreen.main!, withOptions:optionsDictionary)
            self.view.wantsLayer = true

  }

but it shows a black screen when the app is launch see the image.enter image description here

So my question is what's the best way to open the mac os app in full screen with hiding Doc and Menu

0 Answers
Related