https://kotlinlang.org logo
p

Paul Dhaliwal

01/22/2021, 2:22 PM
Can someone explain to me the different use cases for Kotlin Multiplatform and Kotlin Multiplatform mobile? Reading through the KMM website, it seems to me that all the advantages listed also apply to the regular Kotlin Multiplatform. We are a small company and are looking to be able to re-use as much code as possible. The proposal I’ve set forth for my teammates is such: 1) We will use Kotlin Multiplatform to create a library (and eventually an sdk) to contain all of our shared business logic. 2) We will then create a flutter plugin to wrap the multiplatform library, which could be imported into our flutter projects, so we can again write our UIs with a single code base. The reason we’re doing this instead of just creating the library in pure Flutter is that we will eventually turn it into an SDK so that other companies can use it to make apps for their platform of choice. And since the core library would be made with Kotlin Multiplatform that would be possible. (we will continue making our UIs in Flutter since we have experience with it already and to again share code) I’ve successfully created a proof of concept covering the two points above using Kotlin Multiplatform Mobile + Flutter plugin, however, once we start the real work, I’m wondering if it would be better to use the regular Kotlin Multiplatform. After all, if it will generate a JS library for free as we develop, why not?
k

Kris Wong

01/22/2021, 2:29 PM
they are the same technology. KMM is a team within JB focused on mobile use cases.
meaning you don't "pick one or the other"
stated another way, KMM is a subset of KMP
p

Paul Dhaliwal

01/22/2021, 5:56 PM
Thanks for the reply. Is there a page elaborating on what the advantage would be to selecting KMM over KMP? If I got to start a new project in InteliJ I have the option of making a KMP app/library or KMM. I understand that KMM is a subset of KMP, but I don’t understand why I would make a project based on KMM, when a KMP app could be deployed to Android or IOS anyway.
k

Kris Wong

01/22/2021, 6:00 PM
there's no selection
i just happened to publish this today
the only selection is perhaps which new project template you want to use
p

Paul Dhaliwal

01/22/2021, 6:12 PM
Okay thanks I believe I understand. I think for now we will ignore KMM since we aren’t strictly writing for Android and iOS only.
s

Samuel Michael

04/28/2021, 4:56 PM
Again, you don't have to choose. While the KMM plugin is designed to bootstrap cross-mobile development, you can easily add JS or other targets and source sets. It really depends what your development workflow is like, whether you need to run and debug Native Kotlin code from Android Studio, or have people using App Code or Xcode for that
10 Views