Compatibility to iOS 13 and up

For working in companies it is crucial to handle the application for all versions of IOS, if you are swiftUI developer, it is started from IOS 13 but some views work individually for example NavigationStack is only for ios 16, so in this topic, I want to find a solution for this problem

Hi Omid, and welcome,

The solution is simple but may be cumbersome.
Basically choose the minimum version for your app wisely, some app may need to support very old version but most app don't. You can see on this page that 90% of users are using iOS 16 and 8% are using iOS 15. basically 98% of users are using iOS15+
So if you really need to target those 2% left you can go lower but otherwise don't.

Then you can use a combination of @available(iOS "version_number", *) and if #available(iOS 15, *) {...} to guard the code that doesn't work for older version and provide an alternative or a degraded version of the app for people with older version of iOS.


Very good idea, I decided to develop everything by using the latest version of the code but for the earlier versions I can find a solution for that by using @available(iOS "version_number", *)