NetEase Yanxuan iOS App Architecture Evolution: A Case Study in Modularization and Engineering Optimization
The article details how NetEase Yanxuan’s massive iOS codebase was refactored through modularization and layered architecture—splitting the main project, isolating business modules, automating dependency analysis, binaryizing core libraries, and cleaning unused resources—resulting in reduced coupling, a 6% faster compile time, and a sustainable CI‑driven development workflow.
This article presents a comprehensive case study on the architecture evolution of NetEase Yanxuan (严选) iOS application, addressing the challenges of large-scale mobile app development and maintenance.
The article begins by establishing the context: with mobile apps serving as critical channels for user acquisition and retention, and the Yanxuan app reaching million-level code lines, the development team faced increasing pressure from technical and business demands, necessitating architectural evolution.
Architecture Standards and Guiding Principles:
A good architecture must ensure functional completion, provide smooth user experience, and consider extensibility and maintainability. The fundamental principles include: appropriate over advanced, evolution over rapid completion, and simplicity over complexity. The core architectural thinking is summarized as: Mobile Architecture = Modularization (Business Architecture) + Layering (Technical Architecture).
Layering Approach:
From a technical perspective, layering governance involves vertical layers communicating through interfaces with unidirectional dependencies, following the dependency inversion principle. Horizontal layer communication uses routing or event bus, with each business module defining its message agents and external message handling events.
Modularization Approach:
Business-driven modularization addresses boundary ambiguity by combining different components into modules for environment isolation and clear responsibilities. Code belonging to the same function/business is isolated into independent modules to ensure independent operation, achieving high cohesion and low coupling.
Problems Identified:
The analysis revealed significant issues: (1) Project file coupling - main project code占比70%, lack of hierarchical subdivision, missing reference isolation, unclear dependencies; (2) Historical code cleanup difficulties due to severe inter-module coupling; (3) Centralized Git management causing instability; (4) Complex business coupling with multiple targets (main APP, App Clip, Widget, Today View).
Evolution Solutions:
The team implemented: (1) Global module dependency analysis using topological sorting for layered governance; (2) Modularization and granularity decoupling - first coarse-grained separation then fine-grained extraction; (3) Safety improvements through binaryization of core libraries, CI validation, and subspec dependency checking; (4) Main project file剥离 with shell project as target; (5) Unused/duplicate resource removal using tools like WBBlades, Fui, LSUnusedResources, FengNiao; (6) Gradual repair with automated checks including code quality analysis, module dependency analysis, and project hazard detection.
Long-term Guarantee Mechanisms:
CI-assisted analysis with checkpoints at key stages (development, testing, release), and infrastructure capability building with standard template libraries.
Results Achieved:
Main project code reduced from 70% to 45%; removed 340+ unused files; optimized 80+ duplicate interfaces; added 11 binary libraries and 35 new component libraries; improved compilation speed by 6%.
Future Directions:
APP construction platform for rapid scaffolding, and exploration of Swift adoption while addressing LLVM Modules compliance requirements.
NetEase Yanxuan Technology Product Team
The NetEase Yanxuan Technology Product Team shares practical tech insights for the e‑commerce ecosystem. This official channel periodically publishes technical articles, team events, recruitment information, and more.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.