OK got it!
First start the Xcode project with LifeCycle -> AppKit App Delegate, not SwiftUI App.
In the AppDelegate.swift file add:
let mainScreen: NSScreen = NSScreen.screens[0]
window.contentView?.enterFullScreenMode(mainScreen)
at the end of func applicationDidFinishLaunching. Looks like this:
class AppDelegate: NSObject, NSApplicationDelegate
{
var window: NSWindow!
func applicationDidFinishLaunching(_ aNotification: Notification)
{
// Create the SwiftUI view that provides the window contents.
let contentView = ContentView()
// Create the window and set the content view.
window = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 480, height: 300),
styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
backing: .buffered, defer: false)
window.makeKeyAndOrderFront(self)
window.isReleasedWhenClosed = false
window.center()
window.setFrameAutosaveName("Main Window")
window.contentView = NSHostingView(rootView: contentView)// start App in fullScreen mode
let mainScreen: NSScreen = NSScreen.screens[0]
window.contentView?.enterFullScreenMode(mainScreen)
}
func applicationWillTerminate(_ aNotification: Notification)
{
// Insert code here to tear down your application
}
}
And finally set the background color of contentView to white, otherwise it will look dirty gray.
Would be nice to switch fullScreen on and off for different views, still digging.