Swift 3 iOS compatibility

22,830

Solution 1

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

Solution 2

You should use Swift 3.x (it's the latest version of Swift since this answer has been posted).

iOS version is NOT related to the Swift version you should use, instead, some of the new provided apis do support a minimum version of the OS. But -again- it's not related to the programming language it self. For example: an application has been built via Swift 2.x (Deployment Target 9.x) should work on iOS 10; When updating the IDE (xcode), it will support -by default- the latest version of the programming language -Swift-.

Also, You could do:

if #available(iOS 10, *) {
    // use an api that requires the minimum version to be 10
} else {
    // use another api
}
Share:
22,830

Related videos on Youtube

FelixSFD
Author by

FelixSFD

If you think, I flagged your post wrongly, please ping me in chat. You can find me in the SOBotics room. I'm the developer of Guttenberg, a bot that searches for plagiarism on Stack Overflow.

Updated on July 12, 2020

Comments

  • FelixSFD
    FelixSFD almost 4 years

    I'm new to Apple developing and soon I will distribute my app via AppStore. So now I'm using Swift 3 and by default the deployment target is set to iOS 10.0 It means that I won't be able to make it run for example on iOS 8-9? 'Cos in Swift 3 I use new funcs which are not available in later OS

  • rtcarlson
    rtcarlson over 7 years
    This answer is helpful, but I'm curious if anyone knows if Swift 3 is compatible with iOS 7?
  • FelixSFD
    FelixSFD over 7 years
    @rtcarlson Earlier versions were compatible with iOS 7. stackoverflow.com/questions/24001778/… So I think, Swift 3 will work, too. But I have not the possibility to verify this.
  • vaibhav
    vaibhav over 7 years
    @FelixSFD whats the os version requirement, is fine with el caption ?