UIKit Best Practices and Tips
Article Summary
Bohdan Orlov from Bumble challenges a core assumption in iOS development: what if fighting UIKit is the real problem? His team's approach cuts boilerplate while keeping code maintainable.
This article from Bumble's engineering team presents a pragmatic alternative to heavy architectural patterns like VIPER. Instead of abstracting away UIKit with layers of code, Orlov demonstrates how to work with the framework's built-in capabilities to achieve clean architecture with less overhead.
Key Takeaways
- ViewControllers as kings: retain ViewModels instead of the reverse to prevent dangling references
- ViewControllerLifecycleBehaviour protocol hooks into lifecycle without manual forwarding
- Responder chain navigation eliminates transient dependencies deep in view hierarchies
- Entity-Component-System pattern for analytics: decorate UIViews, scan visible hierarchy automatically
Embracing UIKit's design rather than fighting it produces simpler, more maintainable code with fewer architectural layers to support.
About This Article
iOS View Controllers often become bloated. They handle data fetching, business logic, and UI rendering all at once, which makes the code hard to test and difficult to reuse across different screens.
Bohdan Orlov's approach moves networking and persistence into Services. ViewModels stay retained by ViewControllers, which gives you a lightweight MVVM pattern without the heavy architectural overhead.
ViewModels can be tested on their own. You avoid writing the same code multiple times, and your data has a single source of truth that isn't connected to the UI lifecycle. This cuts down on maintenance work.