Skip to content

Instantly share code, notes, and snippets.

@fourplusone
Last active June 1, 2024 05:13
Show Gist options
  • 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