I'm trying to make a SwiftUI created on Xcode 13 work on Xcode 11 (or iOS 13).
There's a similar post here but the suggestions doesn't seem to work on Xcode 11.
My current entrypoint looks like:
@main // <- this does not work on Xcode 11!
struct MyAppWrapper {
static func main() {
if #available(iOS 14.0, *) {
MyApp.main()
} else {
UIApplicationMain(CommandLine.argc, CommandLine.unsafeArgv, nil, NSStringFromClass(AppDelegate.self))
}
}
}
@available(iOS 14.0, *)
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
As in the comment above, Xcode 11 doesn't support @main
. I would like to use AppDelegate
for iOS 13, but use Scene
and WindowsGroup
method on iOS 14 and above.
I can't believe making a SwiftUI project that works across iOS 13~15 is this difficult..
What else can I try?
Update
Info.plist
:
MyApp.swift
:
AppDelegate.swift
:
SceneDelegate.swift
: