Would Swift 5 apps be able to run only on specific iOS versions?
Asked Answered
S

1

8

Recently I have read a few articles about Swift 5 being ABI Stable (which basically means you won't need to pack app's own version of the Swift Dynamic Library within the App bundle) and here is the confusing part:

because Swift will be embedded within the iOS Operating System.

Now that sounds like Swift Dynamic Library would now go directly into iOS. Would that mean that Apps compiled Swift 5 will be able to run only on specific iOS versions?

Shelbyshelden answered 11/10, 2018 at 15:28 Comment(0)
S
13

You're on the right track, but the point is that the app would only run on a specific iOS version or later. The whole goal of ABI stability is to allow a Swift binary (i.e. an app) that was compiled with one version of Swift to be able to interoperate with a binary (i.e. a framework) that was compiled with a different version of Swift.

But yes, to make use of ABI stability, your app would only be able to run on iOS 13 (or whatever version it turns out to be), or later.

This is how things work in ObjC (and C and C++ and most languages). I can build my Objective-C app on iOS 10 and expect that it will link with Foundation and UIKit on iOS 11 without trouble. You can't do that with a Swift library today.

Sikhism answered 11/10, 2018 at 16:1 Comment(4)
I wonder if Swift 5 will be able to include the Swift Dynamic Library within the App bundle for backwards compatibility with older IOS versions, and then iOS could strip it out on install for versions of iOS that don't need it.Beera
It's possible that they'll be able to do this if you upload bitcode while targeting an earlier iOS version. In that case they can rebuild your app to either link to the embedded library or the system library depending on the user's OS version. (It's possible there are things that would prevent that, but I expect that bitcode should support it.)Sikhism
Apple historically has managed transitions skillfully IMO (68K -> PPC, PPC -> x86, MacOS 9 -> OS X) and I suspect they will support backwards compability in some manner for apps built with Swift 5.0. Bitcode may indeed be how they accomplish that.Beera
Turned out to be released with iOS 12.2.Owlish

© 2022 - 2024 — McMap. All rights reserved.