简体   繁体   English

如何同时使用swift 2和swift 3?

[英]How can I use swift 2 and swift 3 at the same time?

Although swift 3 is released, I don't want to update my code just yet, because a lot of the CocoaPods I used are still in swift 2. I don't know what the migrator will do to those pods. 尽管发布了swift 3,但我现在还不想更新代码,因为我使用的许多CocoaPods仍在swift 2中。我不知道迁移器将如何处理这些Pod。 Will they remain unchanged, causing the project to not build successfully? 它们会保持不变,导致项目无法成功构建吗? Or will they be migrated to Swift 3 as well? 还是将它们也迁移到Swift 3? I don't know! 我不知道!

On the other hand, I really want to try out the new syntax and other new features in Swift 3. They seem really cool! 另一方面,我真的很想尝试Swift 3中的新语法和其他新功能。它们看起来真的很酷!

How can I continue developing my existing projects with Swift 2, but for other projects, compile with Swift 3? 如何继续使用Swift 2开发现有项目,而对于其他项目,如何使用Swift 3进行编译?

In other words, how can I choose a compiler for a project? 换句话说,如何为项目选择编译器?

How can I continue developing my existing projects with Swift 2, but for other projects, compile with Swift 3? 如何继续使用Swift 2开发现有项目,而对于其他项目,如何使用Swift 3进行编译?

Install both Xcode 7 (which has Swift 2) and Xcode 8 (for Swift 3) and use the xcode-select command line tool to switch between them. 同时安装Xcode 7(具有Swift 2)和Xcode 8(对于Swift 3),并使用xcode-select命令行工具在它们之间进行切换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM