Swift: No such module 'X' (module not found)
Xcode can’t find a Swift package, pod or framework you import.
Seen on:
iOS
Meaning
CocoaPods projects must be opened via .xcworkspace and built after pod install. Swift packages must be added to the target. Simulator/arch mismatches or a failed package resolution also cause it.
Common causes
- Opened .xcodeproj instead of .xcworkspace (CocoaPods)
- pod install / package resolution not run or failed
- Framework not linked to this target
- Build settings excluding the architecture
⚡ Quick fix
- Open the .xcworkspace and run pod install
- File → Packages → Reset Package Caches / Resolve Package Versions
- Add the package/framework to the target’s Frameworks
Detailed fix by platform
Shell
- swift
pod install open MyApp.xcworkspace xcodebuild -resolvePackageDependencies
How to diagnose
- Workspace — Opened the right file?
- Target — Package in Frameworks, Libraries?
- Logs — Package resolution errors
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Cannot preview in this file SwiftUI Preview: Cannot preview in this file — the preview crashed / failed to build
- CocoaPods compatible versions CocoaPods could not find compatible versions for pod
- Failed to prepare device for development Xcode: Failed to prepare device for development / iPhone is not available. Please reconnect the device
Most viewed in iOS
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026