Badoo Arkadii Ivanov

Badoo's MVI Architecture in Kotlin Multiplatform - Part 2

Original post 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

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.

Continue reading

What This Article Covers

Problem

Arkadii Ivanov's team needed to build platform-specific networking for the shared Kittens module. They wanted to reuse code across iOS and Android, using iosX64, iosArm64, and androidMain source sets.

Solution

They used Kotlin Multiplatform's expect/actual feature to create platform-specific KittenDataSource implementations. iOS used NSURLSession for async operations, while Android used HttpURLConnection with the subscribeOn operator to handle background threading.

Impact

A single shared module could now load image URLs from the network on both platforms without duplicating business logic. This reduced maintenance work and let each platform use its native networking patterns.

Part 3 promises to show how to write unit and integration tests for the shared MVI code—the real test of whether this architecture scales.

This page summarizes “MVI Architecture in Kotlin Multiplatform - Part 2” by Badoo, published Jun 9, 2020. All credit for the original work goes to the authors.

Read the original on badootech.badoo.com (opens in new tab)