Use Swift 2.2 in Xcode 8?

SwiftSwift2Xcode8

Swift Problem Overview


Is it possible to use Swift 2.2 in Xcode 8?

From Xcode 8 release notes:

> "Xcode 8 supports switching toolchains, such as those from swift.org, > without relaunching Xcode. (23135507)"

I have been trying to find swift 2.2 toolchain on swift.org website but couldn't. Have any one success in configuring Xcode 8 to work with swift 2.2

Swift Solutions


Solution 1 - Swift

If you want to continue to use Swift 2 in Xcode 8, then use Swift 2.3 by enabling the Use Legacy Swift Language Version build setting (SWIFT_VERSION = 2.3).

Solution 2 - Swift

Using Swift 2.3 in Xcode 8 by That Thing in Swift provides a good introduction to using Swift 2.3 in Xcode 8.

The following is quoted from the article:

> There’s a single build setting that will let you continue building > your Swift projects with a Swift version that’s mostly similar in > syntax to your existing projects from Xcode 7: Use Legacy Swift > Language Version > > Just drop into your project’s build settings and search for legacy > swift to find the correct build setting, then switch the setting to > YES to opt-in to Swift 2.3 rather than Swift 3 in Xcode 8.

enter image description here

Solution 3 - Swift

It is not possible to use Swift2.2 in XCode8, and it is also not possible to use Swift2.3 or Swift3 in XCode3.

The best solution i found is to create a single project file that will compile for both iOS 9 (Xcode 7) and iOS 10 (Xcode 8), and that will support Swift2.2 and Swift2.3 (very similar).

Solution 4 - Swift

As one of possible solutions to this problem I could suggest to install two versions of Xcode (7.3.1 and 8, for example) side by side.

To accomplish this you should:

  1. Download suitable dmg file from Downloads for Apple Developers. Use search to find Xcode.
  2. Double click this file to see familiar “Drag to install Xcode in your Applications folder” window. But drag this somewhere else for a moment. Desktop would be good. Rename it to Xcode \number of version\ (like Xcode 7.3.1) and then drag it to Applications folder.

That's it.

Solution 5 - Swift

It is not possible to use Swift2.2 in XCode8 by setting Use Legacy Swift Language Version to Yes in Build Settings.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsalabahaView Question on Stackoverflow
Solution 1 - SwiftJimView Answer on Stackoverflow
Solution 2 - SwiftBabatunde AdeyemiView Answer on Stackoverflow
Solution 3 - SwiftyonivavView Answer on Stackoverflow
Solution 4 - SwiftArtem KirillovView Answer on Stackoverflow
Solution 5 - Swifttania_SView Answer on Stackoverflow