"xxx is only available in iOS 15.0 or newer"

I created a new iOS project targeting iOS 15 using Xcode 13.0 beta (13A5154h) on Big Sur to test some new SwiftUI features. 

Xcode shows me the error like "xxx is only available in iOS 15.0 or newer" for all new API for iOS 15. 

  • The project target is iOS 15 

  • I tried to create another project again, same problem. 

Would you please help to fix it? 

Thanks a lot! Philipp

Answered by ihaze in 679715022

use this formula in your code

@available(iOS 15.0, *)
struct MainView15 : View {
....
}


It's due to the fact that the app template sets Target Deployment to iOS 14. To solve it, select the app target and select iOS15 in Deployment Info section.

16
Accepted Answer

use this formula in your code

@available(iOS 15.0, *)
struct MainView15 : View {
....
}


"xxx is only available in iOS 15.0 or newer"
 
 
Q