Module compiled with Swift 3.1 cannot be imported in Swift 4.0

After updating to Xcode 9, I loaded and tried to build my project, which failed.

I use the AwesomeCache, through Carthage and I have a compiler error while importing the .framework.

import AwesomeCache ❌ Module compiled with Swift 3.1 cannot be imported in Swift 4.0

In my target's build settings, the Swift language version is set to Swift 3.2.


Do I need to wait for AwesomeCache to update their library or is there any other way to use Swift 3.1 in Xcode 9 beta?

Yes, you'll have to wait, or you'll have to rebuild the framework yourself from source. If it's open source, rebuilding in 3.2 mode should be pretty much problem-free.

The difference between 3.1 & 3.2 is enough to throw up a roadblock. Anything you can do to move your code to at least 3.2 will make your life easier.


From the docs:


Version Compatibility

This book describes Swift 4.0, which is the default version of Swift included in Xcode 9. You can use Xcode 9 to build targets that are written in either Swift 4 or Swift 3.


NOTE

When the Swift 4 compiler is working with Swift 3 code, it identifies its language version as 3.2—this means you can use conditional compilation blocks like

#if swift(>=3.2)
to write code that is compatible with multiple versions of the Swift compiler.
Module compiled with Swift 3.1 cannot be imported in Swift 4.0
 
 
Q