Migrating to Swift Package Manager
Article Summary
Victor Sarda from Just Eat Takeaway reveals how his team migrated a massive modularized iOS codebase from CocoaPods to Swift Package Manager without blocking a single developer. The secret? Supporting both dependency managers simultaneously.
Just Eat Takeaway's iOS team tackled the challenge of migrating dozens of modules to SPM while multiple teams continued shipping features. They built custom tooling and established new conventions to make the transition seamless across demo apps and their main production app.
Key Takeaways
- Created PackageGenerator CLI tool to auto generate Package.swift files from JSON specs
- Unified structure supports both CocoaPods and SPM during migration period
- RemoteDependencies.json ensures pinned versions across all 60+ modules
- Bundle.module preprocessor macro handles resource access for both systems
- Completed full migration in one week after demo apps validated approach
The team successfully migrated their entire modularized codebase to SPM by building automation tools and maintaining backward compatibility, enabling continuous development throughout the transition.
About This Article
Just Eat Takeaway's iOS codebase used CocoaPods with inconsistent folder structures. Modules were scattered across Assets, Classes, and UnitTests directories, which didn't match Swift Package Manager's conventions.
Victor Sarda's team reorganized the modules into a standard format with Framework, Demo, and Tests folders at the root level. They built PackageGenerator to automatically create Package.swift manifests from JSON spec files using Stencil templates.
The new structure let the team validate the codebase across 60+ modules through CI. After testing the approach in demo apps, they finished the entire migration in one week without manually writing Package.swift files.