When building modular iOS apps with Swift Package Manager (SPM), SwiftUI previews fail to display localized strings from String Catalogs (.xcstrings files). The Xcode preview locale setting and .environment(\.locale) modifier don't resolve internationalization (i18n) resources—previews show string keys instead of translated text.
Common issues:
Bundle.modulenot accessible in preview context- Xcode preview localization not working in SPM packages
- String Catalog strings missing in SwiftUI previews
- Multi-language preview testing broken in modular architecture
A lightweight type-safe localization system for iOS internationalization that fixes SwiftUI preview i18n in Swift Package Manager modules—no SwiftGen, R.swift, or code generation required.
Key Features:
- ✅ SwiftUI preview localization in SPM modules
- ✅ Type-safe string references (compile-time safety)
- ✅ Native String Catalog (
.xcstrings) support - ✅ Multi-language Xcode preview testing
- ✅ No external dependencies or build scripts
- ✅ Pure Swift implementation
Custom LocalizableString wrapper with preview language override system that correctly resolves Bundle.module resources during Xcode preview runtime. Works directly with compiled .lproj bundles from String Catalogs.
Complete implementation guide and technical details →
- Modular iOS apps using Swift Package Manager
- Multi-language applications with internationalization (i18n/l10n)
- Teams wanting type-safe localization without code generation tools
- Projects requiring Xcode preview localization in SPM packages
- SwiftUI internationalization in feature-module architecture
