However I have recompiled the framework using the same Xcode and it still gives me this error.
I hit this issue with Xcode 10 beta, which adds Swift 4.2. My issue was unrelated to Carthage or any external dependencies.
Go to YourTarget > Build Settings > Swift Language Version
for all of your Xcode targets.
Mine were all set to Swift 4
.
After adding a Copy Files Build Phase, I started getting the error
:0: error: module compiled with Swift 4.1.2 cannot be imported by the Swift 4.2 compiler: /Users/user/Library/Developer/Xcode/DerivedData/MyApp-faskfrihumfcdibjxisjvbfshppp/Build/Intermediates.noindex/MyApp.build/Debug/MyAppExtension.build/Objects-normal/x86_64/MyClass~partial.swiftmodule
Command MergeSwiftModule failed with a nonzero exit code
I then set each target's Swift Language Version
to Swift 4.2
, which eliminated the error.
I'm not sure why the error was occuring in the first place, though, as having all targets set to Swift 4
should be equally as valid.