Microapps architecture in Swift. Resources and localization.
Article Summary
Microapps architecture sounds great until you hit the resource bundling wall. Majid Jabrayilov tackles the messy reality of managing assets and localization across modular Swift apps.
When you split your iOS app into microapps (feature modules), resources like images, fonts, and localized strings don't automatically follow. Majid walks through practical solutions for resource management in a modularized Swift codebase.
Key Takeaways
- Swift Package Manager requires explicit resource declarations in Package.swift manifests
- Use Bundle.module instead of Bundle.main to access resources in SPM packages
- Localization works per-module using standard .strings files within each package
- Asset catalogs and fonts need process() declarations in package resources
Resource management in microapps requires explicit bundle handling, but Swift Package Manager provides clean APIs to keep each module self-contained.
About This Article
When you access resources across multiple Swift Package Manager modules, you need to explicitly pass a bundle parameter. If you skip this, the app looks in the wrong place. It searches the app target module instead of the feature module's bundle.
Jabrayilov suggests building type-safe public APIs in shared modules like DesignSystem. These APIs should accept optional bundle parameters. This lets feature modules pass Bundle.module when they create reusable views like PlaceholderView for localized content.
Feature modules can keep their localization strings in their own .lproj folders and still reuse generic design system components. You don't need a centralized resource management system across the microapps architecture.