1

I have a version of my app that runs correctly with iOS 13, but since iOS 14 Apple seem to change the way GeometryReader works (see: iOS 14 has Changed (or broken?) SwiftUI GeometryReader).

The problem is that now there are two different sets of settings regarding the GeometryReader that should be applied for iOS 13 and any newer versions starting from iOS 14.

A. Since this is an app wide problem, is it possible to upload a build that supports only iOS 14 and newer, while maintaining the older build for iOS 13 ?, Would I be able to update the older build separately ?

B.If not, what is the appropriate way to deal with two classes that needs different adjustments for geometry reader settings ? , for example:

GeometryReader{geomtery in
  SomeClass.frame(width:geomtery.size.width/10) // should be divided by a different factor in iOS 14 !
 }
RT.
  • 423
  • 3
  • 12
  • 1
    You can only have one build on the AppStore. So option A is out. If you know the adjustments that you need to make per version then you can use `if #available(iOS 14, *) { } else { }` – Andrew Nov 19 '20 at 08:52
  • Thanks, how can I set it to iOS 14 and newer ? – RT. Nov 19 '20 at 15:54
  • You put the code for iOS 14 and new in the **if** part and the code for everything else in the **else** part. https://www.hackingwithswift.com/new-syntax-swift-2-availability-checking – Andrew Nov 19 '20 at 16:38
  • That's weird I am getting "'buildLimitedAvailability' is only available in iOS 14.0 or newer" when trying to set: if #available(iOS 13.3, *) { // use UICollectionViewCompositionalLayout } else { // show sad face emoji } – RT. Nov 19 '20 at 17:19
  • I dug deeper and it seems like there is a change in behavior even from iOS 13 to 13.3 (at least) that's why I will need it on 13 .3 vs 13 too... The link you added shows it can check against 13 but I am getting an error – RT. Nov 19 '20 at 17:21
  • Yeah, but I am getting an error: "buildLimitedAvailability' is only available in iOS 14.0 or newer" on any version number lower then 14 – RT. Nov 19 '20 at 17:43
  • 1
    Then you will have to construct your own conditional modifier, but do you really need a modifier? You could create a function that computes the correct value for the width of your frame, the body of the function uses the if-else to perform the checks on OS that you need. – Andrew Nov 19 '20 at 17:53
  • Did what you suggested and created a simple function, thanks ! – RT. Nov 20 '20 at 00:42

0 Answers0