Individual Author Jan 26, 2022

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

Critical Insight

Resource management in microapps requires explicit bundle handling, but Swift Package Manager provides clean APIs to keep each module self-contained.

The article includes a clever approach to preview localized content in SwiftUI previews without launching the full app.

About This Article

Problem

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.

Solution

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.

Impact

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.

Recent from Individual Author

Related Articles

AI Tools for iOS

Browse all AI tools →