Swift "Could not find module 'X' for target" in CI
A binary framework or XCFramework ships a Swift module compiled for some architectures but not the one the runner is building for (often arm64 iOS Simulator on Apple silicon), so the compiler cannot find a usable module slice.
What this error means
The Swift build fails with "Could not find module 'SomeKit' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator" or similar architecture mismatch.
error: Could not find module 'SomeKit' for target 'arm64-apple-ios-simulator';
found: x86_64-apple-ios-simulator, x86_64Common causes
The framework lacks an arm64 simulator slice
On Apple silicon runners the simulator target is arm64, but the dependency was only built for x86_64 simulator, so no matching module exists.
A fat framework instead of an XCFramework
A legacy universal framework cannot distinguish arm64 device from arm64 simulator; the proper fix is an XCFramework with both slices.
How to fix it
Use an XCFramework with the simulator slice
- Rebuild the dependency as an XCFramework that includes ios-arm64-simulator.
- Replace the fat framework with the XCFramework in the project.
- Clean DerivedData and rebuild so the new module is picked up.
xcodebuild -create-xcframework \
-framework device/SomeKit.framework \
-framework simulator/SomeKit.framework \
-output SomeKit.xcframeworkBuild for a matching simulator architecture
If you must keep an x86_64-only framework, run the simulator build under Rosetta or target an x86_64 simulator destination.
arch -x86_64 xcodebuild -scheme App \
-destination 'platform=iOS Simulator,name=iPhone 16' buildHow to prevent it
- Distribute binary dependencies as XCFrameworks with all needed slices.
- Build CI simulator targets with arm64 on Apple silicon runners.
- Verify a framework includes ios-arm64-simulator before relying on it.