BugMedic

Module compiled with Swift X cannot be imported by the Swift Y compiler: rebuild or get a stable module

A Swift binary module built by one compiler version cannot be imported by a different one unless it was built with module stability; rebuild it with your toolchain or get a distribution build.

By BugMedic editorial teamLast source review: 2026-09-27macOS

Swift modules are compiler-version-locked unless built with module stability. Rebuild the module with your current Xcode, or get a binary built with BUILD_LIBRARY_FOR_DISTRIBUTION enabled, which Swift.org documents as the setting that turns on both library evolution and module stability.

Try these fixes in order

01

Confirm the two compiler versions

The error names both versions, for example 'compiled with Swift 5.9' versus 'Swift 5.10 compiler'. Confirm what your machine is actually using with the command below, because having multiple Xcodes installed is the usual reason the versions disagree.

xcrun swiftc --version
02

Rebuild the module with your current toolchain

If the module is your own code or an open-source dependency, rebuilding it with your current Xcode regenerates its Swift module for your compiler and clears the mismatch. After rebuilding, clean out the old prebuilt artifact so the stale module is not picked up again, then rebuild the app.

03

For vendor binaries: get a distribution build with module stability

When you cannot rebuild — a closed-source vendor binary — the supported fix is a binary built for distribution. Swift.org documents that setting BUILD_LIBRARY_FOR_DISTRIBUTION in the framework target turns on both library evolution and module stability, and module stability is what lets Swift modules built with different compiler versions be used together in one app. Request such a build from the vendor, in both Debug and Release.

04

Rebuild and confirm the module imports

Rebuild the app with the current Xcode. The error is gone when the previously rejected module imports cleanly. A quick sanity check on a distribution build is the presence of .swiftinterface files next to the framework's .swiftmodule files, which indicates module stability was enabled at build time.

find . -path "*Modules/*.swiftmodule" -name "*.swiftinterface" | head

Interpret what you see

The error appears right after you updated Xcode

What it suggests: Your toolchain moved but the binary module did not; the two compilers no longer agree on the module format.

Next check: Rebuild that module from source with your current Xcode, or obtain a binary built with the same compiler version.

Only one third-party dependency fails while everything else builds

What it suggests: The module predates your toolchain and was never rebuilt for it.

Next check: Check the dependency's release notes for a build matching your Xcode/Swift version, and update to it.

The framework ships .swiftinterface files yet the error persists

What it suggests: Module stability is enabled, so this module is designed to import across compiler versions; the failure may come from a different, non-stable module in the chain.

Next check: Read the full error to confirm which module name the compiler rejects, and check whether that module has a .swiftinterface file.

The vendor confirms the binary was built without BUILD_LIBRARY_FOR_DISTRIBUTION

What it suggests: The framework was built without library evolution and module stability, which are off by default.

Next check: Ask the vendor for a build with BUILD_LIBRARY_FOR_DISTRIBUTION enabled, or rebuild it yourself with that setting in both Debug and Release.

Why this happens

  • Swift's compiled module format is not stable across compiler versions unless the framework was built with module stability, so a binary built by one Xcode cannot be imported when you build with another.
  • The framework vendor shipped a binary built without library evolution support (no BUILD_LIBRARY_FOR_DISTRIBUTION), so it only imports with the exact compiler that produced it — the supported opt-in for cross-compiler use is documented by Swift.org.

Still not working?

If the steps fail, record the exact pair of Swift versions from the error, the output of xcrun swiftc --version, which Xcode produced the failing framework, and whether the framework's .swiftinterface files exist (their presence indicates module stability was enabled). If you maintain the framework, also record the BUILD_LIBRARY_FOR_DISTRIBUTION setting for both Debug and Release configurations.

Official sources

These steps are based on the linked documentation and general diagnostics. BugMedic has not independently tested every product and system configuration. Review commands before running them.

Related Xcode guides