Just Eat Victor Sarda Jan 25, 2023

Migrating to Swift Package Manager

M2 Related OWASP risk: Inadequate Supply Chain Security Learn more →

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

Critical Insight

The team successfully migrated their entire modularized codebase to SPM by building automation tools and maintaining backward compatibility, enabling continuous development throughout the transition.

The article includes their open source PackageGenerator tool and the exact folder structure that made supporting both dependency managers possible.

About This Article

Problem

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.

Solution

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.

Impact

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.