Skip to content

Instantly share code, notes, and snippets.

@fourplusone
Last active November 17, 2023 15:58
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fourplusone/f5ca1eb213cd548f5c0099da17dd0147 to your computer and use it in GitHub Desktop.
Save fourplusone/f5ca1eb213cd548f5c0099da17dd0147 to your computer and use it in GitHub Desktop.
SwiftUI Command Line App
import SwiftUI
struct MainApp : App {
var body: some Scene {
WindowGroup {
Text("Hello").padding()
}
}
}
DispatchQueue.main.async {
let app = NSApplication.shared
app.setActivationPolicy(.regular)
app.activate(ignoringOtherApps: true)
}
MainApp.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment