Search code examples
androidiosflutterwebkotlin-multiplatform

Can I create an android, ios and web with the same codebase of kotlin


I have created an android app with kotlin and it is on-demand to make it available for Web-app and IOS as well. So I searched on Google to find a way to do that and I got something like Kotlin for multiplatform and after reading that I got a point that it is possible to create an IOS app too with the same codebase.

But I don't know that the same codebase can also work for the web app or not? Or the question can be that "Is it possible to make an app for all the 3 platforms with the same codebase?"

Or I should switch to Flutter? But if I switch to flutter then I have to start migrating it from scratch. Which would be so time consuming. But I have listened, that we have to write the code for once on flutter and run it anywhere. While with kotlin I have to change many things for different platforms?

Am I right? What would be a better approach for the long term?


Solution

  • With Kotlin Multiplatform, you can get up to ~80% shared code between platforms, theoretically.

    Yes, this means that generally your UI, but other platform specific things also will have to be rewritten for every platform.

    In your case, I think it makes sense to move towards this direction. You'll have to adapt your kotlin code a bit, make the UI for Web and iOS, but you'll get native quality, and more control over the platforms. At least this is what I would choose if I already have a kotlin codebase, let me know if you have more questions