MVI Architecture in Kotlin Multiplatform - Part 2
Article Summary
Arkadii Ivanov from Bumble shows how to bridge Kotlin Multiplatform MVI architecture with native iOS and Android UI. The iOS integration reveals surprising complexity that most KMP tutorials skip.
This is part 2 of a 3-part series on implementing MVI architecture in Kotlin Multiplatform. After building shared business logic in part 1, Ivanov tackles the platform-specific implementations—creating data sources with NSURLSession for iOS and HttpURLConnection for Android, then integrating the shared component into SwiftUI and Android Views.
Key Takeaways
- iOS requires proxy classes to bridge Kotlin MVI with SwiftUI's ObservableObject pattern
- Android integration is straightforward using AbstractMviView with RecyclerView and SwipeRefreshLayout
- KittenDataSource uses expect/actual to implement platform-specific networking in shared module
- SwiftUI lifecycle limitations demand ComponentHolder class to manage component destruction properly
Critical Insight
Integrating KMP business logic with native UI is simple on Android but requires additional wrapper classes on iOS due to SwiftUI's reactive patterns and Kotlin-Swift interop limitations.