Snippet: The Evolution of Facebook’s iOS App Architecture ☇
Dustin Shahidehpour on Engineering at Facebook Meta:
Facebook for iOS (FBiOS) is the oldest mobile codebase at Meta. Since the app was rewritten in 2012, it has been worked on by thousands of engineers and shipped to billions of users, and it can support hundreds of engineers iterating on it at a time.
After years of iteration, the Facebook codebase does not resemble a typical iOS codebase:
- It’s full of C++, Objective-C(++), and Swift.
- It has dozens of dynamically loaded libraries (dylibs), and so many classes that they can’t be loaded into Xcode at once.
- There is almost zero raw usage of Apple’s SDK — everything has been wrapped or replaced by an in-house abstraction.
- The app makes heavy use of code generation, spurred by Buck, our custom build system.
- Without heavy caching from our build system, engineers would have to spend an entire workday waiting for the app to build.
FBiOS was never intentionally architected this way. The app’s codebase reflects 10 years of evolution, spurred by technical decisions necessary to support the growing number of engineers working on the app, its stability, and, above all, the user experience.
The post gets into a bit of technical details that are fascinating, but the tone strikes me as weird. While it’s great to celebrate milestones, it seems a little odd to be happy about layers of legacy code and nonstandard, custom choices that lead to a 300MB app that does most of the same things as a web page.