Missing Import Errors in Swift
Swift's No such module 'X' error means the compiler can't find the module. This is usually a dependency configuration issue, not a missing import statement.
Swift Package Manager
// Package.swift
let package = Package(
name: "MyApp",
dependencies: [
.package(url: "https://github.com/Alamofire/Alamofire", from: "5.8.0"),
],
targets: [
.target(
name: "MyApp",
dependencies: ["Alamofire"]), // Must list here too!
]
)swift package resolve
swift buildXcode: Framework Not Linked
In Xcode projects:
- Select your target → General → Frameworks, Libraries, and Embedded Content
- Add the missing framework
- Clean build folder:
Cmd+Shift+K
CocoaPods
# Podfile
pod 'Alamofire', '~> 5.8'pod install
# Open .xcworkspace, NOT .xcodeprojCommon Swift Imports
import Foundation // Strings, dates, networking basics
import UIKit // iOS UI (not available on macOS)
import SwiftUI // Declarative UI
import Combine // Reactive programming
import CoreData // PersistenceBridging Header for Objective-C
If importing an ObjC library:
// MyApp-Bridging-Header.h
#import <SomeObjCLib/SomeObjCLib.h>Then use it directly in Swift without an import statement.
Bugsly's iOS SDK captures runtime crashes with symbolicated stack traces, including module load failures that might not surface until a specific code path is executed.
Try Bugsly Free
AI-powered error tracking that explains your bugs. Set up in 2 minutes, free forever for small projects.
Get Started FreeRelated Articles
Why Your Error Tracking Tool Doesn't Explain Errors (And What to Do About It)
Most error tracking tools show you stack traces but leave you guessing about root causes. Learn why AI-powered analysis changes everything.
Read moreHow to Fix Encoding Error in Rust
Learn how to fix the Encoding Error in Rust. Step-by-step guide with code examples.
Read moreFix Missing Import in Rails
Resolve NameError and LoadError in Rails applications, covering autoloading, Zeitwerk conventions, and gem dependency issues.
Read moreHow to Fix DatabaseError in Rails
Learn how to fix the DatabaseError in Rails. Step-by-step guide with code examples.
Read more