Create SwiftUI App outside of Xcode Project

I have this clip saved away from somewhere to make it work:

struct MyApp: App {
    init() {
        // Some stuff to make the app work properly when `swift run`.
        // We are before `NSApplicationMain` here so queue it.
        DispatchQueue.main.async {
            NSApp.setActivationPolicy(.regular)
            NSApp.activate(ignoringOtherApps: true)
            NSApp.windows.first?.makeKeyAndOrderFront(nil)
        }
    }
...