Home » Swift » Conversion to Swift 3 with Xcode 8

Conversion to Swift 3 with Xcode 8

Posted by: admin November 30, 2017 Leave a comment

Questions:

To use Xcode 8 with a Swift project we have to convert it to the new Swift 3 syntax.

I’ve a project with several cocoapods. First, I have installed all the new versions of these pods from the respective sources, so they are already converted to the Swift 3.

Then, I used the Edit -> Convert -> To current Swift syntax choosing Swift 3 for my main target (basically the real app). Everything seemed to be fine, but at the first build I received a lot of errors, even simple ones, fixable with the CMD+ALT+CTRL+F, but they increase at every build. I think that this conversion tool is not the best one, or something went wrong..

Can you point me to the right direction?

Screenshot to show you the problems

screenshot errors

Answers:

I know that it is sad, but there is no other solution than changing your code manually. It is the same with constrains which are also different and you have to change them all (if they are wrong) :/ .

Questions:
Answers:

You can goto free services (for big files you must upgrade accont) ,
clear and easy :

Online Convertor

You can make convertion by converting small block of code . Sometimes line by line .

Other way is to make objectiveC bridge in your swift3 project.

Use (in combination with online convertor) Auto correct from xcode 8.Its very useful (must be careful with auto correct sometimes you will degrade code ).

In the basics : Its not bad , you must fix all errors manually .Best way for learn swift 3 . 90% of errors are very easy to fix , just follow logs …