Mobile Development 30 min read

App Factory: iOS‑Centric Theory and Practice for Multi‑App Generation

The article introduces the concept of an App Factory—a code‑generation platform that, based on a unified component library and dependency graph, can produce multiple iOS applications on demand while eliminating unused code, and details its architecture, implementation methods, quality controls, and real‑world results within 58.com’s ecosystem.

58 Tech
58 Tech
58 Tech
App Factory: iOS‑Centric Theory and Practice for Multi‑App Generation

App Factory, as the name suggests, is a production line that generates apps from a complete component library and their dependency relationships. It enables a single codebase to be assembled into multiple independent iOS applications, each containing only the code required for its specific business scenario.

The traditional single‑app development model bundles all code together, making dependency and coupling considerations unnecessary. In a multi‑app environment, however, the same codebase must be selectively packaged for each target app, requiring a redesign of architecture, code organization, and dependency management.

The core goals of the App Factory are to standardize output, accelerate development, and support the generation of innovative, vertical, and lightweight ("instant") apps. Achieving these goals hinges on a strict "generate‑only‑needed‑code" principle, which is technically challenging.

From an iOS perspective, the article describes the App Factory’s architecture, which consists of an entry project (responsible for configuration) and a pool of pods categorized into business pods, middleware pods (both business‑specific and standard), and base‑library pods. Standard middleware provides reusable services such as networking, caching, location, and routing, while business middleware contains strongly coupled business logic.

Dependency rules are enforced: upper layers may depend on lower layers, but lower layers must not depend on upper layers; pods within the same layer must not depend on each other; and middleware may only depend on base‑library pods. These rules are verified by automated tools that construct a directed graph of pod dependencies, detect reverse dependencies, cycles, and standard‑middleware pollution.

Implementation steps include extracting common vertical‑business libraries, integrating them into each independent app, and performing code‑level decoupling through file relocation, method extraction, compile‑time indirection (notifications, runtime calls), and protocol‑based isolation.

Practical experience is illustrated through the "Jupiter" project, where the rental and second‑hand housing verticals were split from 58.com and Anjuke apps. By extracting shared middleware and base libraries, the project saved approximately 73 MB for the rental transfer and 28 MB for the second‑hand housing transfer, with negligible impact on crash rates.

Additional case studies cover the generation of innovative and instant recruitment apps, highlighting pod‑dependency analysis, decoupling techniques, and risk mitigation strategies such as version‑merge oversight and data‑coupling management.

In summary, the App Factory provides a layered, dependency‑controlled architecture that enables rapid, on‑demand generation of multiple iOS apps, reduces package size, and maintains stability across large‑scale, multi‑team development.

Mobile Developmentcode generationiOSdependency managementApp FactoryPod Architecture
58 Tech
Written by

58 Tech

Official tech channel of 58, a platform for tech innovation, sharing, and communication.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.