codeOfRobin / fast-cli-swift

[WIP]: A (rearchitected) Swift port of https://github.com/sindresorhus/fast-cli in Swift, no third party frameworks. No disrespect to the original author intended, this is purely academic work
5 stars 0 forks source link

Take advantage of the application delegate #1

Closed davedelong closed 4 years ago

davedelong commented 4 years ago

This moves all the loading and publisher setup to the "applicationDidFinishLaunching()" method.

Since you're using the NSApplicationDelegate trick for a long-running CLI, I think it makes more sense to start the loading process once your CLI "application" is done loading, just like a regular iOS or macOS application.

Therefore, I've moved all the WebView configuration and publisher setup to inside this method, and am now using properties to manage object lifetimes, instead of relying on top-level scoping to keep things around.