Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// main.swift
|
||||
// GreenshotMac
|
||||
|
||||
import AppKit
|
||||
|
||||
/// NSApplication.delegate is a weak reference, so the delegate is held here for the
|
||||
/// lifetime of the process.
|
||||
enum AppLauncher {
|
||||
@MainActor private static var retainedDelegate: AppDelegate?
|
||||
|
||||
@MainActor
|
||||
static func launch() {
|
||||
let application = NSApplication.shared
|
||||
let delegate = AppDelegate()
|
||||
retainedDelegate = delegate
|
||||
application.delegate = delegate
|
||||
application.setActivationPolicy(.accessory)
|
||||
application.run()
|
||||
}
|
||||
}
|
||||
|
||||
// Top-level code always runs on the main thread, so assuming main actor isolation is safe here.
|
||||
MainActor.assumeIsolated {
|
||||
AppLauncher.launch()
|
||||
}
|
||||
Reference in New Issue
Block a user