Tokopedia Arya Surya May 18, 2021

Getting Started with iOS App Modularization: Extracting Catalog

Article Summary

Tokopedia's iOS team tackled a common scaling problem: how do you break apart a monolithic app without creating circular dependency chaos?

This hands-on tutorial from Tokopedia Engineering walks through extracting a Catalog feature into its own framework. It's part 2 of a modularization series that shows the practical steps, not just theory.

Key Takeaways

Critical Insight

A Router abstraction layer lets iOS features navigate between modules without creating circular dependencies or tight coupling.

The tutorial includes a GitHub repo with working code at each stage, plus the final part covers building individual frameworks instead of the entire app.

About This Article

Problem

When Arya Surya's team tried to extract the Catalog framework, they hit a circular dependency problem. Product Detail Page needed to import Catalog, but Catalog also imported Product Detail. This created a dependency loop they couldn't solve.

Solution

Tokopedia Engineering added a Router abstraction pattern to the Shared framework. This let modules navigate to other parts of the app without importing them directly. Instead, route handlers defined in SceneDelegate handled the navigation, keeping the destination frameworks separate from the source modules.

Impact

The modularization approach worked. Catalog and Shared frameworks were successfully extracted into separate Xcode targets. The app kept working, navigation between modules stayed smooth, and there were no tight coupling issues or build failures.