BlaBlaCar Sep 27, 2017

RxSwift MVVM Architecture Pattern

Article Summary

Martin Moizard from BlaBlaCar reveals a critical MVVM pitfall that breaks when you switch from simple views to UITableViews. The culprit? How you feed inputs to your ViewModels.

After a year of using RxSwift with MVVM at BlaBlaCar, the team discovered their initial approach to ViewModel inputs had a fatal flaw. Views that lazily load content (like UITableViews) couldn't provide all inputs synchronously, breaking the entire pattern. This article walks through two approaches to solving this architectural challenge.

Key Takeaways

Critical Insight

ViewModels need flexible input mechanisms to work with any view type, and strategic use of private Subjects solves this without sacrificing testability or clean architecture.

The article includes working code examples showing exactly how Kickstarter solved this same problem using a completely different reactive approach.

Recent from BlaBlaCar

Related Articles