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 !
 }
8
  • 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 { } Commented Nov 19, 2020 at 8:52
  • Thanks, how can I set it to iOS 14 and newer ? Commented Nov 19, 2020 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. hackingwithswift.com/new-syntax-swift-2-availability-checking Commented Nov 19, 2020 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 } Commented Nov 19, 2020 at 17:19
  • 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. Commented Nov 19, 2020 at 17:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.