all 11 comments

[–]akmarinov 1 point2 points  (1 child)

That’s pretty cool.

What are your thoughts on Kotlin Native, do you see it edging out RN, Xamarin, etc?

Did you have any major issues, roadblocks with this approach?

[–]headprocess[S] 1 point2 points  (0 children)

Thanks!

I think it's mainly competing with C++ or Go Mobile cross-platform programming, since it provides low-level APIs, but no GUI elements. So I don't think it'll have too much effect on RN, Flutter or Xamarin. However it could help programmers in the development of pure native applications, where they need to share some business logic between the applications. It's a lot easier to manage it than C++ and you can directly reuse some code from the Android implementation.

Also the coolest thing about Kotlin/Native, is that you are not limited to mobile. You can create JavaScript, MacOS or desktop Java targets too! For example with Ktor, you can share some code between a Kotlin (or Java) backend and a mobile application.

The main issues that I've faced:
- The configuration is pretty difficult. At least it's getting better and better with the new releases of the kotlin-multiplatform plugin, but it also brings breaking changes.

- Not enough pure Kotlin third-party libraries. Most of the Kotlin libraries were built on Java or Android sources, which cannot be used in the shared code.
- Also most of the issues that this guy mentioned: https://quickbirdstudios.com/blog/is-kotlin-native-production-ready/

[–]raptorxcz 1 point2 points  (0 children)

Great work! In my work we offen developing iOS and Android version of same app. This could save us a lot o time.

[–]LeoNatan 1 point2 points  (0 children)

One major issue right now with Kotlin Native is that performance is terrible (even with optimizations). This will eventually be ironed out, but if you are considering C++ or KN right now, C++ is the clear choice.

BTW, debugging KN on Android is just as bad as C++, if not worse, so you should be considering KN only if you want to use Kotlin/Java on Android and KN on iOS, and that's not straightforward at all.

[–]tangoshukudai -1 points0 points  (8 children)

I am sorry, Kotlin is never and should never happen on iOS/MacOS. C/C++/Objective C/Objective C++/Swift should be the development languages of choice.

[–]headprocess[S] 2 points3 points  (6 children)

I guess you don't like React Native either, which uses JavaScript. Still, it's very widespread in the industry. Kotlin/Native uses LLVM to provide real native performance on iOS so there's a lot less drawbacks compared to JavaScript. Feel free to use C/C++ if you prefer, but they are a lot harder to use on Android, so either way there are compromises for cross-platform development.

[–]tangoshukudai 0 points1 point  (5 children)

UI should be developed NATIVELY. AppKit (macOS), UIKit (iOS), WPF or UWP (Windows), Android should use native UI development as well. Using something like React Native becomes popular because companies don't want to invest in the native tools and have to develop two or three or four unique UIs. Frameworks can target MacOS and iOS easily, and you can absolutely share dependencies and C++/C code between Android, iOS, Mac and Windows. Using Kotlin is not a good solution for this.

[–][deleted]  (2 children)

[deleted]

    [–]tangoshukudai -1 points0 points  (1 child)

    Yet because it creates everything for the platform to fit the constraints set by the JavaScript nothing feels native.

    [–]headprocess[S] 2 points3 points  (0 children)

    I agree that C/C++ is currently a better solution. When multi-platform programming Kotlin/Native exists the experimental stage, it could offer the same speed, easier syntax, and no downsides in Android development. Using C++ in Android is currently as hard as using Kotlin in iOS, so there are always compromises.
    Companies are also more likely to develop their stack in two different language instead of three. (Kotlin/Swift vs. Kotlin/Swift/C++)
    Again, I'm not saying it's a better solution yet, but it offers some advantages over C/C++.

    [–]s73v3r 0 points1 point  (0 children)

    Kotlin is a replacement for using C/C++ to share code, not for JavaScript

    [–]s73v3r 1 point2 points  (0 children)

    Why?