Moving Lottie Swiftly into the Future

A personal story on how Airbnb rewrote the popular open source library Lottie in a new language

Tyler Hedrick
7 min readbeginner
--
View Original

Overview

The article discusses Airbnb's decision to rewrite the popular open-source library Lottie from Objective-C to Swift, reflecting on the challenges and benefits of this transition. It highlights the importance of modernizing codebases to align with current programming practices and the growing adoption of Swift among developers.

What You'll Learn

1

How to effectively transition a large codebase from Objective-C to Swift

2

Why rewriting legacy libraries can improve maintainability and developer experience

3

When to consider a complete rewrite versus incremental updates in software development

Prerequisites & Requirements

  • Familiarity with Objective-C and Swift programming languages
  • Experience in mobile app development, particularly with iOS(optional)

Key Questions Answered

Why did Airbnb decide to rewrite Lottie in Swift?
Airbnb decided to rewrite Lottie in Swift to improve interoperability, leverage Swift's modern language features, and address the challenges of maintaining a hybrid codebase. The shift reflects the broader industry trend towards Swift, as over 50% of top non-game apps were using it by 2019.
What challenges did developers face with Objective-C and Swift interoperability?
Developers experienced difficulties with Objective-C and Swift interoperability, including context switching issues and the complexity of maintaining a hybrid codebase. This made it harder for contributors to work effectively and slowed down the library's evolution.
What improvements does Swift offer over Objective-C for library development?
Swift offers several improvements over Objective-C, including better immutability, stricter access controls, powerful enum types, and functional programming paradigms. These features enhance code maintainability and allow for more modern programming practices.

Key Statistics & Figures

Percentage of top non-game apps using Swift
over 50%
This statistic highlights the growing adoption of Swift in the industry as of 2019.
Percentage of Airbnb app written in Swift
more than 90%
This indicates Airbnb's commitment to modernizing their codebase and fully transitioning to Swift.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Library
Lottie
Used for rendering Adobe After Effects animations natively on mobile and web platforms.
Programming Language
Swift
The new language used to rewrite the Lottie library for better maintainability and performance.
Programming Language
Objective-c
The original language in which Lottie was developed before the rewrite.

Key Actionable Insights

1
Consider a complete rewrite of legacy systems when facing significant interoperability issues and maintenance challenges.
This approach can lead to a more cohesive codebase and improve developer productivity, as seen in Airbnb's transition from Objective-C to Swift.
2
Embrace modern programming languages like Swift to attract new talent and improve team dynamics.
As more engineers learn Swift first, maintaining older Objective-C code can hinder collaboration and accessibility for new developers.
3
Engage with the open-source community during major library updates to gather feedback and contributions.
Airbnb's commitment to open source allowed them to improve Lottie significantly through community involvement, which can be a valuable resource for any project.

Common Pitfalls

1
Rewriting a large codebase without proper planning can lead to confusion and integration issues.
It's crucial to assess the benefits and challenges of a rewrite versus incremental improvements to avoid disrupting ongoing development.
2
Neglecting community feedback during open-source projects can result in missed opportunities for improvement.
Engaging with contributors can enhance the quality of the library and foster a collaborative environment.

Related Concepts

Open-source Software Development
Modern Programming Languages
Library Maintenance And Evolution