Module compiled with Swift 5.0.1 cannot be imported by the Swift 5.1 compiler

Just need to set the Build Libraries for Distribution option to Yes in your framework's build settings.


This problem is caused by the fact that you attempt to embed a pre-compiled framework that was created with a different compiler version.

Currently, pre-compiled frameworks can only be embedded if the compiler versions match! The swift compiler version that is used to compile the project must be the same version that was used to compile the framework.

Hopefully, this restriction will be removed in future Swift / compiler versions... For more information refer to the chapter on "Module Stability" here: https://swift.org/blog/abi-stability-and-more

As already mentioned in one of the comments, the solution to this problem is to up- or downgrade to the appropriate Xcode version. (Or, if possible, recompile the framework with the desired compiler version and then use the same compiler version for your project.)


enter image description here If you using React Native to build your App, go to Xcode and click on File->Workspace Settings...-> if you notice there is a small arrow that is the path to the DerivedData folder, click on that and the actual folder will appear with other iOS related folders, DELETE the DerivedData folder and rebuild your App. everything will work smoothly now... thank me later


I was getting a similar problem for Sqlite.swift. Doing the following command worked for me:

carthage update --platform iOS --no-use-binaries

This was suggested here.

Tags:

Ios

Swift

Xcode11