Thumbtack Scott Southerland Jul 12, 2023

Migrating to Apollo 1.0 for iOS

Article Summary

Scott Southerland from Thumbtack reveals how their iOS app hit a breaking point: 8-minute builds, mysterious crashes, and 80,000-line auto-generated files that finally stopped compiling altogether.

Thumbtack adopted Apollo iOS for GraphQL back in 2018, but by 2022 their code generation had spiraled out of control. The culprit? Apollo 0.5's fragment handling created exponentially more types instead of consolidating them, bloating their codebase until the Swift compiler literally gave up.

Key Takeaways

Critical Insight

Migrating from Apollo 0.5 to 1.0 delivered an 80% code reduction, 92% faster release builds, and 25% smaller binaries while rescuing Thumbtack from a complete development standstill.

The article breaks down exactly why Apollo's old fragment system created exponentially bloating code and the specific refactoring challenges teams will face during migration.

About This Article

Problem

Thumbtack's Apollo 0.5 code generator was creating duplicate nested types for every query that used fragments. This caused some auto-generated files to balloon to over 80,000 lines, forcing developers to disable the debugger just to avoid Signal 9 crashes when launching the simulator.

Solution

Scott Southerland's team upgraded to Apollo 1.0, which completely rewrote the code generator to stop creating redundant types from fragments. The migration wasn't simple though. They had to refactor test mocking, remove mutable response types, and update how the codebase handled nullability and enums.

Impact

Generated code dropped by over 80%. CI debug builds got 50% faster. Release builds improved by 92%. The app store binary shrank by 25%. After months of blocked development, Thumbtack could finally ship features again.