I'm in the process of adopting some of the new SwiftUI features released in macOS 11, namely using the App type. The result of this is that I need to switch between the new type that's conforming to App and the older AppDelegate in my code based off of the os version running.
To do this, I need to introduce a new main function but am unsure of the syntax required. Does anyone have some pointers as to how I could do such an implementation?
Much thanks.
To do this, I need to introduce a new main function but am unsure of the syntax required. Does anyone have some pointers as to how I could do such an implementation?
Much thanks.
Sorry, my question may not have been entirely clear. I've got an @availability check around the new stuff. What I needed to do was create a main.swift file that does the switching between the new type which conforms to App and the older AppDelegate implementation. This ended up looking like the following.
Code Block if #available(macOS 10.16, *) { MyAwesomeNewImplementaitonOfApp.main() } else { let app = NSApplication.shared let delegate = AppDelegate() app.delegate = delegate app.run() }