-7 C
New York
Sunday, January 16, 2022

Tech World

Building Large-Scale iOS Apps at Airbnb

The Airbnb iOS team has addressed the challenge of a growing and complex mobile app code base by adopting new tools and processes, including modern build systems, module types, and development apps.

The first hurdle the Airbnb team had to circumvent was Xcode’s slowness, especially when indexing files and build code, and “incompatibility” with code release systems:

Not only is it difficult to review Xcode project files in pull requests, but merge conflicts and race conditions in these project files increase as a larger team of engineers moves at high speed.

Xcode is very powerful and offers an unparalleled level of integration with iOS and other tools by Apple, but it lacks some features that were essential to Airbnb engineers, such as a network cache for creating artifacts, a query interface for a build graph, and a way to add custom steps such as dependencies.

To offer all of these features to developers, Airbnb chose Facebook Buck, a building system based on the same Starlark language that Google’s Bazel uses. Buck allows Xcode workspaces to be created from a declarative build graph, thus ensuring a level of optimum integration with the iOS development ecosystem. Instead of using Xcode’s native build system, which cannot take advantage of artifact caching, Airbnb has extended Buck so that it builds Xcode projects that seamlessly call Buck to build. This makes build up to 5-6 times faster when the HTTP Buck cache is enabled.

Besides optimizing their infrastructure, Airbnb engineers designed a discovery-oriented organizational structure for their code base by organizing units into groups called Unit types. Each module type contains a set of visibility rules that define the permissible dependencies between modules of that type.

For example, the module type is File Feature, which is a file UIViewController, which may include the child UIViewControllers but not others Features. Features Can only communicate with each other through Feature interface, which is another module type with a broader view.

According to Airbnb engineers, module types act as a table of contents for the entire code base and convey their meanings instantly.

The third innovation for Airbnb iOS infrastructure is development applications, which is an ephemeral, on-demand Xcode workspace for a single module and its dependencies.

The popularity and success of both the Android and iOS Dev apps stem from a simple axiom: reducing the scope of your IDE to the files you’re editing only tightens the development loop.

Dev applications are built using a command line tool that uses Buck to discover the files needed to create a required module. The tool also creates a container application that hosts the feature and makes it operable. Most Dev apps can be created in less than two minutes, say Airbnb engineers.

This comprehensive approach, which resulted in the identification of approximately 1,500 units, also made it possible to effectively enforce code ownership and improve test coverage.

Airbnb’s approach to building iOS apps at scale includes a lot more than can be covered here, so don’t miss the original writing if you’re interested.

.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Stay Connected

0FansLike
3,113FollowersFollow
0SubscribersSubscribe

Latest Articles