xcode iOS:从 Swift 3 迁移(升级)到 Swift 4

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44391788/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:00:39  来源:igfitidea点击:

iOS: Migration (Upgrade) from Swift 3 to Swift 4

iosswiftxcodeswift4xcode9

提问by Krunal

Recent major update in iOS application development tool Xcode 9supports Swift 3.2 & 4programming language.

iOS 应用程序开发工具的最新重大更新Xcode 9支持Swift 3.2 & 4编程语言。

I've my app developed with Swift 3 version and I want to convert/migrate, complete source code from Swift 3 to Swift 4. During migration, it's showing me 354 errors.

我的应用程序是用 Swift 3 版本开发的,我想从Swift 3 to Swift 4. 在迁移过程中,它显示给我354 errors

These errors are fixable. The solution of error is suggested by Xcode itself. But there are 354 errors. How can I fix them all at once? Manual fixing of each error one-by-one will be a time-consuming activity.

这些错误是可以修复的。错误的解决方法是Xcode本身建议的。但是有354个错误。我怎样才能一次修复它们?逐个手动修复每个错误将是一项耗时的活动。

Is there any feasible solution to fix all errors at once.

是否有任何可行的解决方案可以一次性修复所有错误。

Here is a snapshot with the sample.

这是示例的快照。

enter image description here

在此处输入图片说明

回答by Moin Shirazi

We have a better option to fix this error at once. It can be solved out from Editormenu

我们有一个更好的选择来立即修复此错误。可以从Editor菜单中解决

enter image description here

在此处输入图片说明

Use this option to fix all the error at once in class.

使用此选项可在课堂上一次性修复所有错误。

Note:You cannot always rely on Xcode suggestions, but for migration case it will work in most of the case.

注意:您不能总是依赖 Xcode 建议,但对于迁移案例,它在大多数情况下都有效。