Airbnb Cal Stephens Jun 24, 2025

Understanding and Improving SwiftUI Performance

Article Summary

Airbnb's SwiftUI features were re-rendering way more than they should. The culprit? SwiftUI's hidden diffing algorithm was working against them.

Cal Stephens and Miguel Jimenez from Airbnb's iOS team discovered that common SwiftUI patterns were causing massive performance hits. Their investigation revealed how SwiftUI's reflection-based diffing works and why it often fails with real-world code.

Key Takeaways

Critical Insight

By understanding SwiftUI's diffing behavior and creating tooling to control it, Airbnb reduced scroll hitches by 15% on their most performance-critical screens.

The article includes a visual debugging trick using random colors that instantly reveals which views are re-rendering too often.

About This Article

Problem

SwiftUI's reflection-based diffing algorithm breaks down when views have non-Equatable properties like closures from Airbnb's unidirectional data flow library. This makes entire views non-diffable and causes unnecessary re-evaluations.

Solution

Airbnb engineers built the @Equatable macro to generate custom Equatable conformances automatically. Developers can use @SkipEquatable to exclude non-diffable properties, and the build system catches regressions before they ship.

Impact

Airbnb applied @Equatable and split large view bodies into smaller diffable pieces. On their main Search screen, scroll hitches dropped by 15% while keeping their feature architecture flexible.