Lottie and Swift at Airbnb
Article Summary
Airbnb rewrote their massively popular Lottie animation library from scratch in Swift. Here's why they chose a complete rewrite over incremental updates.
Tyler Hedrick from Airbnb's iOS team shares the personal and technical journey behind migrating Lottie, the open-source animation library used by over 50% of top apps, from Objective-C to Swift. Written in 2019, this reflects a pivotal moment in iOS development.
Key Takeaways
- Over 50% of top apps now use Swift, but Lottie was stuck in Objective-C
- Hybrid codebases force painful context switching and block modern language features
- Swift's structs, pattern matching, and protocols enable cleaner, more maintainable code
- Newer iOS engineers learn Swift first, making Objective-C projects increasingly inaccessible
- Open sourcing the rewrite early brought immediate community contributions and improvements
Airbnb chose a full Swift rewrite to future-proof Lottie, reduce technical debt, and make the codebase accessible to modern iOS developers.
About This Article
Tyler Hedrick found a bug in Lottie where animation layers weren't hiding correctly based on button state. The problem was that the codebase was written in Objective-C across many layers, with contributions from different engineers who had their own coding styles.
Airbnb worked with Brandon Withrow to rewrite Lottie in Swift. Swift's structs, pattern matching, and protocol-oriented programming made the code cleaner and easier to maintain, so modern iOS engineers could contribute without as much friction.
Once Airbnb integrated the new Swift version into their app, Tyler could debug issues directly and fix them himself. He also added Objective-C compatibility support. The rewrite made it easier for engineers across the community to improve the library.