Improving the iOS Listing Screen with Generics
Article Summary
Etsy's iOS listing screen handles 16% of all app traffic. But after a decade, its monolithic architecture was slowing everything down.
Etsy's iOS team tackled a classic legacy code problem: their most critical screen had become a performance bottleneck and developer productivity nightmare. Engineer Hector García Peña shares how they refactored using Swift generics and protocols.
Key Takeaways
- Replaced monolithic view with UICollectionView to defer layout computations
- Built generic cell configuration using Swift protocols and associated types
- Eliminated repetitive switch statements that grew with every new cell type
- Achieved compile time type safety between cells and view models
- New sections now plug in without manual registration or casting
Critical Insight
By abstracting cell configuration with generics, Etsy made their highest traffic screen more performant while letting engineers add features without boilerplate overhead.