

During the investigation of solutions to the problem, we went through a couple of options that I will cover in this article. While exploring the limits of code sharing between Android and iOS, we faced the challenge of having to consume these asynchronous flows from Kotlin in Swift without inhibiting the ease of use in Android. While Flow is straightforward to consume in Android (and JVM targets in general), representing interfaces in Objective-C/Swift brings with it the limitations of protocols, including a lack of generic type parameters. One of the key components of coroutines in Kotlin is the Flow type, which is the interface all asynchronous flows in Kotlin implement.

If you’re already familiar with Kotlin, you may know about the concept of coroutines in Kotlin that greatly simplifies threading and asynchronous programming in general. To get Kotlin compiled for iOS, a KMM project needs to be created in Android Studio 4.My team recently started developing components for our mobile applications using Kotlin Multiplatform Mobile with Jetpack Compose on Android and SwiftUI on iOS. The app quality is not affected because UI uses native components, and the business logic is compiled into a native library. Touchlab advertises itself as the subject’s expert, and has created their own Kotlin libraries for missing support. Mobile dev housesĬompanies working for clients can cut development costs without sacrificing app quality or performance. Netflix saved duplication of 50% of their codebase, because Kotlin libraries can handle both the network and database operations. Kotlin can be recommended for: Bigger projects with more resourcesįor a shared business logic that can be implemented with currently available Kotlin libraries, migrating to KMM can be a good idea.

Since KMM is in the early stages, with relatively steep learning curve and bugs, lacking community and library support, Flutter or React Native might be suggested for smaller teams and simpler apps.
