Files
Snaggle/GreenshotMac/App/main.swift
T
2026-09-17 15:15:45 -05:00

26 lines
687 B
Swift

// 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()
}