Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert to Current Swift Syntax Failed - "No such module" (Swift 4, Xcode 9)

In Xcode 9, I am trying to do the automatic conversion to Swift 4. It fails with the following message:

enter image description here

Convert to Current Swift Syntax Failed
Please ensure that all selected targets build successfully with the currently configured Swift version before attempting a migration.

It's complaining of a missing module. But when I do a regular build there are no issues. Not sure if this is relevant, but the module (which Xcode is complaining is missing) was already converted to Swift 4 earlier (in it's own project).

Note: No Cocoapods / Carthage used here.

Note: Two solutions tried (and worked) but do not address the underlying issue.

  • One solution is to do the conversion manually (change Swift version to 4 in build setting and apply Fix-Its one by one until no more build errors).
  • Another solution is to disable the third party framework (comment out all code where it's used), do the auto-migration, and then re-enable the framework. This could get pretty difficult with bigger projects.
like image 276
Nikolay Suvandzhiev Avatar asked Sep 21 '17 08:09

Nikolay Suvandzhiev


4 Answers

I can't find any solution yet.

For now I fix manually setting Swift Language Version

enter image description here

After changing from 3.2 to 4.0 I compile and fix errors and warnings manually.
I'm waiting for a better solution!

like image 190
Luca Davanzo Avatar answered Oct 18 '22 19:10

Luca Davanzo


I also got this problem while converting my project to Swift 4.0. Looks like problem appears when you try to convert target which imports a framework which is already in Swift 4.0. At your screenshot you try to convert 'RecipeTextParser' which imports 'SovaTools' which is already Swift 4.0.

I found dirty, but working solution. You can use older(Swift 3.2) version of 'SovaTools' when converting. You should NOT check it's mark in target selection window of conversion tool. Then, when 'RecipeTextParser' will be successfully converted you can use Swift 4.0 'SovaTools' version again.

like image 38
Padavan Avatar answered Oct 18 '22 18:10

Padavan


I got this error and in my case one of my Pods(the one Xcode was complaining about) was a Swift 4 target and the rest were Swift 3.2. Looking at the build logs it looks like Xcode built that framework in one location and was searching for it in another. When I reverted that Pod to an older version(that used Swift3.2) the problem went away. Obviously a Xcode bug. HTH

like image 5
niladri Avatar answered Oct 18 '22 19:10

niladri


Just update your pod and it will resolve the issue.

To update pod:

  • open terminal and go to your project directory
  • type pod update

This resolved my issue.

like image 3
Arqam Butt Avatar answered Oct 18 '22 19:10

Arqam Butt