XCode 13 / Swift 5.5 breaks module stability

After updating to XCode 13, our library no longer works on XCode 12, even though module stability is enabled

The XC12 build fails with the following error:

arm64-apple-ios.swiftinterface:14:8: error: no such module '_Concurrency'
import _Concurrency

failed to build module 'XXXXX' from its module interface; the compiler that produced it, 'Apple Swift version 5.5 (swiftlang-1300.0.31.1 clang-1300.0.29.1)', may have used features that aren't supported by this compiler, 'Apple Swift version 5.4.2 (swiftlang-1205.0.28.2 clang-1205.0.19.57)'

To be clear: my code does not use any of the Swift 5.5 concurrency features.

You do not use but the compiler 5.5 may use. As written, compiler may have used for module 'XXXXX' ; can you check the API you use in this module ? Module stability is upward compatibility, not necessarily downward.

May be a bad approach, but just sharing this. I am not really sure why import _Concurrency getting added in the file arm64-apple-ios.swiftinterface located in our swiftmodule folder. Open that file and Just comment this import statement and this error disappears.

@Claude31, In my case, the module is my iOS Framework. I have very few Swift files (say less than 5) Not doing anything with Swift 5.5 APIs. All other files are Obj-c files. As you told, if Module stability is Upward compatible only.. Then does it mean, a framework project having minimum deployment target as iOS 11 and compiled & built using Xcode 13 cannot be used in an iOS project built using Xcode 12.4/ 12.5/12.5.1 as they have lower version of Swift 5.5 ??

After updating to XCode 13, our library no longer works on XCode 12, even though module stability is enabled

This is expected -- a library built with a newer complier cannot be used by an older complier. Please see my more detailed explanation in another thread.

Open that file and Just comment this import statement and this error disappears.

I strongly discourage you from doing this as the solution. Please understand the details of module stability through my above explanation, and how you should define requirements for clients of your framework.

I have the same problem。how to disable swift concurrency

Same problem here

Solved the problem by changing every occurrence of

import _Concurrency

by

#if compiler(>=5.5.2) && canImport(_Concurrency)
import _Concurrency
#endif

You can add -Xfrontend -disable-implicit-concurrency-module-import to OTHER_SWIFT_FLAGS to avoid import _Concurrency in .swiftinterface files.

Useful if you ship a closed source product and want to allow using it with Xcode versions prior to 13.

  • Xcode versions prior to 12
XCode 13 / Swift 5.5 breaks module stability
 
 
Q