Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Swift 2.2 in Xcode 8?

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

like image 817
salabaha Avatar asked Jun 15 '16 12:06

salabaha


People also ask

Which Xcode version supports Swift 3?

Swift 3 is the primary development language supported within Xcode 8 so there are a couple notes to consider if you chose to continue using Swift 2.3. First, Swift 2.3 and Swift 3 are not binary compatible so your app's entire code base needs to pick one version of Swift.

Does Swift work on Xcode?

The Swift compiler and runtime are fully embedded throughout Xcode, so your app is constantly being built and run.

Is Xcode only used for Swift?

Xcode is only compatible with Apple technologies, while despite challenges, Swift provides the opportunity for cross-platform interoperability. Since Swift is a programming language, it does not provide any tools for development, but Xcode relies on tools and functionalities to build iOS and Mac applications.


3 Answers

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).

like image 83
Jim Avatar answered Oct 21 '22 20:10

Jim


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

like image 36
Babatunde Adeyemi Avatar answered Oct 21 '22 22:10

Babatunde Adeyemi


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).

like image 6
yonivav Avatar answered Oct 21 '22 21:10

yonivav