如何选择Swift编译器版本

如何选择Swift编译器版本

本文介绍了如何选择Swift编译器版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Xcode 7.3,但是我的项目在Swift 2.1中.我现在不想更新我的代码.那么如何选择或下载旧版本的Swift编译器呢?提前非常感谢!

解决方案

我最初发布的是评论,但我应该将其发布为答案:

如果您正在为App Store编写应用程序,则只能使用Xcode的发行版(非Beta版)(请参阅使用Xcode将应用程序提交到App Store")和该版本的Xcode随附的工具链(请参阅使用下载/Apple平台").因此,您既可以使用Xcode 7.2并继续使用Swift 2.1,也可以使用Xcode 7.3并将代码更新为Swift 2.2.

您可以安装Xcode的多个版本.您可以保留Xcode 7.2的安装并将其用于未更新的Swift 2.1项目,并在新项目上使用Xcode 7.3.请注意,您将必须在相应版本的Xcode中手动打开每个项目. 您可以在这里下载旧版本的Xcode.

如果您不打算将应用程序放入App Store,那么也许,您可以从Xcode 7.2包中提取Swift 2.1工具链,并将其转换为 a .xctoolchain与Xcode 7.3一起使用,但是如果走那条路,您的位置实际上是未开发的,不受支持的地区. /p>

I'm using Xcode 7.3 but my project is in Swift 2.1. I don't want to update my codes right now. So how can I choose or download older version of Swift compiler? Many thanks in advance!

解决方案

Originally I posted this is a comment, but I should have just posted it as an answer:

If you're writing an app for the App Store, you can only use a release (non-beta) version of Xcode (see "Submitting Apps to the App Store using Xcode") and the toolchain supplied with that version of Xcode (see "Using Downloads / Apple Platforms"). So you can either use Xcode 7.2 and continue using Swift 2.1, or you can use Xcode 7.3 and update your code to Swift 2.2.

You can have multiple versions of Xcode installed. You can keep Xcode 7.2 installed and use it for your non-updated Swift 2.1 projects, and use Xcode 7.3 on new projects. Note that you'll have to manually open each project in the appropriate version of Xcode. You can download old versions of Xcode here.

If you're not going to put your app in the App Store, then maybe you could extract the Swift 2.1 toolchain from the Xcode 7.2 bundle and turn it into a .xctoolchain for use with Xcode 7.3, but you're really in unexplored, unsupported territory if you go that route.

这篇关于如何选择Swift编译器版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 07:33