Facebook’s ComponentKit Is A New Framework For Building iOS App Interfaces

At its F8 developer conference, Facebook today announced the launch of ComponentKit, a new Objective-C library the company built to improve the performance of its iOS app. As Facebook notes, ComponentKit uses a functional and declarative approach to building user interfaces that focuses on one-way data flow from immutable models.

As Facebook engineer Daria Stroganova noted in a session at F8 today, ComponentKit takes many of its cues from Facebook’s work on React.

The company developed this library in order to improve the performance of the news feed in its app. Traditionally, iOS developers would create views for their headers, text views, footer views and other parts of the feed. Then, those views would go into subviews, the developers would add constraints so that they all look the same and then add even more constraints to make sure those views are all in positioned correctly.

ComponentKit, on the other hand, lets developers declare what they want and abstracts all the UI rendering away. Layout happens in the background.

11057196_402546303253191_1790488917_n

Using this new approach, Facebook managed to reduce the amount of code it takes to display the newsfeed in the iOS app by 70 percent and this move has also significantly improved scroll performance. The company says this also increased developer productivity significantly. Rolling out a new feature for the newsfeed in the iOS app now only takes a few days instead of months, the company says.

Facebook itself has been using ComponentKit in its iOS app for the last couple of months. The code is now available on GitHub.