0
votes

When I try to compile the repo https://github.com/Bernie-2016/fieldthebern-ios I run into a swift conversion issue. "This workspace has projects that contain source code with an earlier version of swift."

"Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly."

When I try "edit -> convert -> To current swift syntax" Opens up selecting targets to convert, many of which are frameworks. Proceeding with the conversion yields >3,000 errors in the console.

I think the solution is to grab the latest libraries via cocoapods and then complete the conversion with the main project code but am not getting any luck.

1
That's definitely the solution. You require a Swift 3 version of each and every framework you have. Go check the repositories for those frameworks and ensure that they have a Swift 3 branch/tag or that their master branch is now on Swift 3. You'll want to point your podfile at these Swift 3 versions and recreate the project with that before trying to convert. - Michael Fourre

1 Answers

1
votes

Make sure that your podfile references a Swift 3 branch for every Framework.

Then you need to cd into your project folder using Terminal

Run: pod update

once done, open your project in Xcode and you should be prompted to convert into the latest Swift Syntax automatically, if you weren't you have to do it manually in

Edit > Convert > To Current Swift Syntax…

when all changes are prompted, click update

this will again display 999+ errors but no worries.

run the clean command Cmd + Shift + K and then build Cmd + B

you should have no more errors and if you do have errors, they shouldn't be a lot and you would have to go through the errors manually to fix them

its completely normal, it became a routine thing for me when using CocoaPods