Swift 3 iOS Compatibility

Swift 3 iOS compatibility

You can make your app run on iOS 8 & 9 by setting the Deployment Target to one of these versions. Swift 3.x is compatible with iOS 8 and newer (I'm not sure, but it might be also compatible with iOS 7). The only difference to Swift 2.2 (regarding the system requirements) is that you have to use Xcode 8.

When you set your Deployment Target to an earlier version than iOS 10, you should be aware that you cannot use APIs that are new in iOS 10. (except you use the #available operator) But using Swift 3 should be no problem.

Edit: You can now upload apps written in Swift 3 using Xcode 8.0 GM

What versions of Swift are supported by what versions of Xcode?

Since I've been gathering data and doing tests, I'll post my results as an updated chart in this answer:

A chart depicting the different versions of Swift as compared to their respective versions of Xcode. Last updated 2020-02-25

Awhile ago, I found out that newer versions of Xcode do not, in fact, support migrating from all older versions of Swift. I did explicitly test that Xcodes 10.2 through 11 don't support Swift 3.x and earlier, so I colored those white. I've not yet had time to test Xcode 8.3 through 10.1, but I suspect they will migrate 3.x but not 2.x or earlier; that's why there's a big "Unknown" block at the top.



Sources

  • Manual testing with this test code: https://github.com/BenLeggiero/Swift-Version-Checker
  • Xcode Release Notes
  • Swift Release Notes

Swift 3.0 or Swift 2.3 minimum system version requirement and is it deployed in iOS 7

Minimum OS X to run Xcode 8 which is compatible with Swift 3 is OS X 10.11.4 (OS X EL Capitan)

Sample Image

And I think Swift 3 does not support iOS 7

As you have minimum target in Xcode 8 is iOS 8.0

Sample Image

And as per App Store support measurement iOS 8 (11%) and iOS 9 (84%) better that you stop support for iOS 7 as per my opinion. iOS 10 is coming soon.

Sample Image

I need clarity on difference between swift 3 compatibility and API availability

if the Apple docs say something is only available from iOS 10 and above, does that mean I can only use it on an app that's target is iOS 10 and above?

No. The availability part of Apple's docs may show two different kinds of info -- the SDK availability and the target OS availability.

In the case of Data, the Standard Library code of Data is compatible for all iOS's 8 and later, but the Standard Library including Data (Swift 3 Standard Library) is included only in iOS SDK 10 or later, the availability part of the Apple's doc is representing the "availability" in that meaning.

This thread in the Apple's dev forums would be some help. Generally, you can rely on the availability checking feature of Xcode/Swift. When you marked your project's minimum target to iOS 8.0 and you get no warnings about availability, all the features used in the project should work on iOS 8.0 devices.

You can send a bug report about this as a documentation error.

iOS April30 (extended to June30) 2020 Requirements -- iOS 13 SDK, All-Screen Design, Launch Storyboard, Swift3


  1. Swift 3.0 is being deprecated by Apple, you will need to use at least 4.0 from April 2020

  2. Yes, exactly as with the Swift version you can target an older version of iOS with the latest Xcode.

  3. You can only target 13 and up for those features as the APIs are not included in any older version.

Is swift 3 not compatible with NSURL classes on iOS 9?

Thanks to OOPer i can answer my own question:

the code works fine with the URL class but only when you set the Deplyoment Target to the same iOS Version as your simulator!

XCode 8 updated my iOS 9 SDK to version 10 and so I only had the choice to use the simulator on either iOS 10 or iOS 8.1. However the Deployment Target was set to iOS 9 (I was pretty sure that it was before the upgrade set to iOS 8.1).

So I run into the runtime error with an iOS 8.1 simulator and Deployment Target set to iOS 9.

But it does work with iOS 8.1 simulator and Deployment Target set to iOS 8.1!

Here is the Swift 3 Code working also with iOS 8.1:

class ServerCom: NSObject, URLSessionDownloadDelegate {

fileprivate var localFileURL: URL = URL(string: "dummy")!

[...]

guard let urlString: URL =
URL(string: params,
relativeTo: URL(string: dcParam.baseURL) ) else {
let failed = "Could not generate URL from: \(dcParam.baseURL)\(params)"
throw fetchAppXmlError.failed_URL_GENERATION(failed)
}

var request = URLRequest(url: urlString)
request.timeoutInterval = 10
request.httpMethod = "GET"
[...]

}

Thank you!

Is Swift 3 fully backwards compatible with previous OS versions

Every Swift app is shipped with the Swift standard library included. The advantage of this is that it can run on multiple OS versions by default. The negative point is that it adds a few MB to your final app bundle.

So yes, your app will work on previous versions but keep in mind that you can't submit apps to the Mac App Store until Xcode 8 GM will be released.



Related Topics



Leave a reply



Submit