"*** 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 "*** 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

Replies

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.

  • Thanks zedzefrzferferf, that fixed it for me!

Add a Comment

use this formula in your code

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


  • Point and click method: In Xcode 13 beta 1, you can click on the compile time error for "*** is only available in iOS 15.0 or newer" over on the right hand side, the red error button. Red dialog opens, scroll down to "Add available attribute to enclosing struct" click fix, done. Thanks @ihaze for helping me figure this out.

Add a Comment