Chances are you upgraded to the latest Xcode and along with it, your Swift compiler is updated as well. Then existing projects using a particular project have stopped working with similar error such as.
Module compiled with Swift 5.1.3 cannot be imported by the Swift 5.2.4 compiler:
Or you are checking out some hosted on code on Github using some framework, the framework might have been built using an older compiler version, if you try to run the associated .xcodeproj or .xworkspace it won’t build the project.
This is only for frameworks built using Carthage. I haven’t experienced this on CocoaPods. Make sure you have Carthage installed – check this documentation on how to install Carthage – https://github.com/Carthage/Carthage
To fix, take a backup of your project, or better yet make sure you are using version control. Delete the framework that is failing from your project.
Go to the Project directory from the Terminal and make sure the Cartfile is available and run. Choose the right platform for the app.
carthage update --platform IOS
It should create a newly .framework on the Carthage/Build folder.
On Xcode go the General Tab and under Framework, Libraries and Embedded Content. Drag and drop the files
Then finally, try running the build and your project should be working.
Hope you find this tip useful.