Hi,
is it possible to have access to NSApplicationDelegate methods like
With "access" I mean equivalent functionality. I know there is support for a document based app using the Swift UI App Life Cycle, which would seem to resolve the issue for that particular openFiles delegate method, but for various reasons I can't use the document based app life cycle.
Thank you!
Cheers, Michael
is it possible to have access to NSApplicationDelegate methods like
Code Block application(_ sender: NSApplication, openFiles filenames: [String])
when using the Swift UI App Life Cycle?With "access" I mean equivalent functionality. I know there is support for a document based app using the Swift UI App Life Cycle, which would seem to resolve the issue for that particular openFiles delegate method, but for various reasons I can't use the document based app life cycle.
Thank you!
Cheers, Michael
Have you tried @NSApplicationDelegateAdaptor?
I've only tested it briefly with applicationDidFinishLaunching(), but that method does get called.
I've only tested it briefly with applicationDidFinishLaunching(), but that method does get called.
Code Block @main struct TestApp: App { @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate var body: some Scene {} } class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_ notification: Notification) { print("hello") } }