Have you tried @NSApplicationDelegateAdaptor?
I've only tested it briefly with applicationDidFinishLaunching(), but that method does get called.
@main
struct TestApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {}
}
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
print("hello")
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: