I'm writing a document-based application for Mac in Swift 4, which, according to my client needs, has to show a licensing window were the user will provide its license key.
I show this window at the applicationWillFinishLaunching()
method. While this window is active, the state restoration methods run in the background and load previous nsdocuments, or create empty ones if there were no previous.
I want to avoid that, I want to be able to choose when restoration and behaving like a document based app starts.
I've tried to intercept the launching of the app in the appDelegate method applicationShouldOpenUntitledFile(_ sender: NSApplication)
but I was not successful. Then I've read here that this method doesn't gets called if application state restoration is active.
To confirm that, I deactivated the restoration, and then last documents or empty documents were not loaded / created anymore as expected. Great!
But then, I loose the nice restoration functionality.
I'm wondering if there is a better way to do this: displaying a licensing screen in a document-based app, halting the restoration methods, and manually calling them after app is licensed.
Thanks