I am new to SwiftUI and thinking of converting my UIKit app. My deployment target is the last version of iOS 13. If I compile the app to iOS 16 will the new SwiftUI features be compatible on an iOS 13 device or should I wait until I drop support?
For example, I don't want to have to add two versions of navigation view by adding "if version" block for the new NavigationStack since I have not used SwiftUI previously.
Most, if not all, of the new iOS 16 features in SwiftUI will only be available from iOS 16 onwards. This is what Apple tends to do every release, so you will have to wait for your minimum deployment target to catch up with the version you need features from if you don’t want to have a lot of if-available checks.
Saying this, there are some features from earlier versions of SwiftUI that, even though have been replaced, will still work on the latest versions.
For example, in iOS 13-14 you would style a List
like this:
.listStyle(PlainListStyle())
Although in iOS 15 it was reworked to this:
.listStyle(.plain)
the older approach will still work.
Furthermore, NavigationView
has only been soft-deprecated so will continue to work as expected on iOS 16.
Check the documentation to see the minimum platform deployment information for each API.