Module compiled with Swift 4.1.2 cannot be imported in Swift 4.1.50: Xcode 10 Error

Sahil Kapoor picture Sahil Kapoor · Jun 5, 2018 · Viewed 15.2k times · Source

Swift 4.2 came out and I'm receiving this error message in my project when using ObjectMapper and some other pods too:

Module compiled with Swift 4.1.2 cannot be imported in Swift 4.1.50

So how do I tell Xcode to start updating my project and migrate it to Swift 4.2?

Answer

Ed. picture Ed. · Jul 18, 2018

You are not compiling your Carthage module with the proper swift version. So you need to:

  1. Make sure your terminal is pointing to your Xcode 10 Beta app and not your regular Xcode:

sudo xcode-select -switch Xcode_beta_10.app

  1. Update your Carthage files:

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

  1. Go back to your project in Xcode, clean, build