简体   繁体   中英

Using Xcode 12 build errors for target macOS 10.15

As of Xcode 12.3, when you create a new SwiftUI project with a target of macOS, Xcode defaults the target to 11.0 (Big Sur). Without changing a line of code in the default "hello world" app created by default, I then change the target to macOS 10.15 (which is what I am still using) The default project swift file will no longer build.:-


@main
struct catalinaApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}```

3 Errors: @main, 'Scene' and WindowGroup is only available in macOS 11.0 or newer

How can I alter the project/above file to correctly build the default app on Catalina? (10.15) ?

thanks in advance!

Thanks to @Raja Kishan, the answer is simply to choose the App Delegate option in the choices for Lifecycle when creating a new project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM