Ivy

    Ivy

    1 year ago
    Hello, I’d like to hear your feedback on which is a better way to develop a mobile cross-platform. It’s been more than 3 years since I developed the Android app, but it’s my first time developing a cross-platform. So I wonder if the Kotlin Multiplatform Mobile(KMM) is more effective than React Native or Flutter. KMM needs to write the UI code for each platform, but is KMM a more effective way? What do you think of that? If you know a good post about that, please share the link. Thanks in advance. 😄
    d

    Dmitry

    1 year ago
    So… I spend last 3 months building a cross-platform app. It was for a MVP version of a platform of a startup that I joined. Important: I was solo developer. The deal with KMM ( as you said) is that you need to write UI code for each platform. If you are in position to afford that (e.g. you already have couple people/several teams), then it’s a really good way to go. I saw several points of feedback, where people where questioning how much they were able to share between platforms with KMM. But I guess that’s a bit subjective. If you are solo developer, without much prior experience with mobile - I would recommend going with Flutter or React Native. I spend probably a solid few days reading everything that I could about which one of those I should pick. I went through forums, SO’s, subreddits (both for RN and Flutter). General consensus is: • React Native is more mature, and in general you can do everything you want with it (different UI’s, integrations, payments and so on) • If you are coming from a web dev background (especially with React) - RN will be a huge productivity boost from beginning (you can use almost everything you are already familiar with, except for things like Navigation). • There are things like Expo that allow you start developing RN apps really quickly, and easily test them on real devices • There are ready infrastructure (CI, updates with release, tooling) for RN But… Flutter is just a better technology. It’s built from ground up. It’s cohesive. It’s performant. It has great tooling (Android Studio). I picked RN because I was not in position to invest 2-3-4 weeks to get familiar with Flutter. But I would do exactly that if I could. I now observe how another team is starting with Flutter, and it looks really promising. However there are several issues with Flutter, because of how new it is. Especially when it comes to integrating 3rd party SDK’s (e.g. showing ads, or doing in app purchases). There might not be ready-to-use library for that. Ah. And I also don’t like Dart as a language. In latest Dart release they finally added nullable types, so it might become better.
    kenkyee

    kenkyee

    1 year ago
    The Weather Channel uses Flutter FYI... Team was apparently twice as productive after adopting it according to a co-worker who was working on it. As long as everyone commits to Dart, it doesn't seem like a bad option...
    Twice as productive as native app devs...the apps were previously all native.
    Ivy

    Ivy

    1 year ago
    @Yev Kanivets Thanks a lot! I read your post and clapped! 👍 I understood your point. After I read your post and then I thought KMP has strength that can manage common business logic and use powerful Native UI at the same time.
    @Dmitry Thank you for sharing your experience. It really help a lot. 👍 My team is not that big, but we have already native Android and iOS apps. And I tried to do Flutter before, I don’t like Dart like you as well. So to be honest, I considered between KMM and RN. After I heard your experience, I think KMM is better in my case. We have already native apps. And I should sometimes connect with another hardware devices like Raspberry Pi. Your advices really helped a lot to me!!
    @kenkyee Thank you for sharing the example! 👍 I’ll consider the productive perspective again!
    kpgalligan

    kpgalligan

    1 year ago
    They're very difficult to compare because they're very different tech. Flutter and RN require you to adopt an entirely different language and platform, and are very difficult to integrate with "native" apps. KMP/M is designed to allow you to share code but not lock you into a whole ecosystem. It's a lot less risky to try out, essentially.
    @kenkyee Do you have any more detail on TWC? Without going into detail, lets say that's news to me.
    kenkyee

    kenkyee

    1 year ago
    They switched over a few years ago... Everyone sounded happy :blob-shrug:
    kpgalligan

    kpgalligan

    1 year ago
    Interesting. Thanks.
    d

    Daniele B

    1 year ago
    @Ivy with KMP you can easily share 85% of the code, if you use an MVI architecture with Kotlin’s StateFlow, and the new declarative UIs (JetpackCompose and SwiftUI). You can find all the details in this article:https://danielebaroncelli.medium.com/the-future-of-apps-declarative-uis-with-kotlin-multiplatform-d-kmp-part-1-3-c0e1530a5343
    kenkyee

    kenkyee

    1 year ago
    How did you get the 85% number? I was on a xamarin project and it was only 60% code shared...UI was native.
    kpgalligan

    kpgalligan

    1 year ago
    Well, depends how much logic you have.
    kenkyee

    kenkyee

    1 year ago
    That I'd agree with....blanket 85% across the board? 🤔
    Yev Kanivets

    Yev Kanivets

    1 year ago
    I would say 30% is more realistic from my experience + you get consistent View contracts with MVP or similar architecture.
    d

    Daniele B

    1 year ago
    @kenkyee the new declarative UI toolkits (JetpackCompose and SwiftUI) are stateless, requiring a very limited logic: just basic conditional statements, at most. This means they are an extremely thin layer compared to the traditional mobile UI toolkits. With Kotlin's StateFlow and the MVI pattern, you can fully share your ViewModel across the different platforms. This allows you share 85% of the code, according to 2 apps we have already written using this architecture.
    ludOS

    ludOS

    1 year ago
    Hi @Ivy if I may, I propose a LGPL project that can give some idea for code sharing: • only the UI is native (iOS client is not implemented yet. It will require some custom service and jobs equivalent code) I'd be happy to anwer question, this was our Covid project, a team of 1.1 with me as senior Android dev. Doing it as a hobbyhttps://github.com/f8full/herdr Badly documented right now but that should improve a lot in the coming weeks and month as the Play Store alpha is about to be deployed for MVPs
    Ivy

    Ivy

    1 year ago
    @Daniele B really thank you!! I read all series and clapped them 👍!! After that, I started coding as an MVI pattern and referred to your code snippets. During the project, I’ll figure out how much share the code in multiplatform. I hope I would like to reach 85% as you mentioned.
    @ludOS thanks a lot!! 👍 It’ll really help me because I am an Android developer as well. I’ll review and refer to all of your projects this weekend.
    d

    Daniele B

    1 year ago
    @Ivy I am glad you found the article useful. If you have any doubt, feel free to ask.
    b

    Barco

    1 year ago
    @Daniele B any chance of a full repo being published? Loved the article series, so would be great to see it all in action.
    d

    Daniele B

    1 year ago
    @Barco I hope to publish one sometime soon. But in the meantime, you should find all the relevant snippets in page 3/3 of the article.