Given Airbnb’s multimillion line iOS codebase, we were excited by the potential for SwiftUI to reduce the amount of code required to build UI. In an early experiment in which we rewrote our review card we saw a 6x reduction in lines of code –from 1,121 lines to a mere 174 lines of code! Over the past 2 years we have seen reductions in lines of code of similar magnitudes as our SwiftUI adoption has progressed.
Performance
UI performance was a key concern as we evaluated SwiftUI. Fortunately, after running multiple experiments, we verified that the page performance score when using SwiftUI was comparable to a UIKit implementation. We noticed a small overhead when instantiating UIHostingController, but were able to reduce this by adding a reuse pool of hosting controllers to Epoxy.
Adoption & Developer Satisfaction
With much excitement about SwiftUI within the company, organic adoption of the framework has been rapid. Our limited pilot of building components in SwiftUI began in January 2022, with general availability beginning later that May. Building entire screens in SwiftUI entered the pilot phase in October 2022 and then entered general availability in January 2023.
As of September, we have over 500 SwiftUI views and roughly 200 SwiftUI screens. Many of the screens for Airbnb’s 2023 Summer Release were fully powered by SwiftUI.