代码从Swift 2.x迁移到Swift 4 [英] Code migration from Swift 2.x to Swift 4
问题描述
我们有一个足够大的项目,该项目由Swift 2.x构建,现在Apple刚刚发布了Swift 4,因此可以继续前进以获取最新版本的Swift我们可以选择的路径...
We have big enough project which is built up with Swift 2.x and now Apple has just released Swift 4 so to move forward for latest version of Swift which path we can choose...
我们是否需要先将代码迁移到Swift 3?还是我们可以使用Xcode 9将代码直接迁移到Swift 4?
推荐答案
是的,您必须在Swift 3兼容版本中迁移代码. Xcode 9仅允许从swift 3.0进行转换/迁移.
Yes, you must migrate your code in Swift 3 compatible version. Xcode 9 allows conversion/migration from swift 3.0 only.
Swift 3.2受Xcode 9&两者都是Xcode 8.
Swift 3.2 is supported by Xcode 9 & Xcode 8 both.
使用Xcode 8将源代码从Swift 2.0转换为3.2,然后继续使用Xcode 9(Swift 3.2或4).
Convert your source code from Swift 2.0 to 3.2 using Xcode 8 and then continue with Xcode 9 (Swift 3.2 or 4).
为便于代码迁移,请按照以下步骤操作:(它将帮助您隐蔽到Xcode工具支持的swift的最新版本中)
For easier migration of your code, follow these steps: (it will help you to covert into latest version of swift supported by your Xcode Tool)
(Xcode)菜单:编辑►隐蔽►更改为当前的Swift语法
(Xcode) Menus: Edit ► Covert ► To Current Swift Syntax
这篇关于代码从Swift 2.x迁移到Swift 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!