https://kotlinlang.org logo
Title
m

Malte

06/29/2018, 1:36 PM
Hey guys, our team is currently developing an image processing engine in Kotlin that is used in our Android and in the future also in the iOS app. Currently, its’ an Android library running on the JVM but we need to find a solution to share the code base with iOS (no Android specific code involved). We see these most favourable options: 1. Using Kotlin Native 🚀 2. Using Swift and accessing it via JNI Wrapper on Android (we need to rewrite our Kotlin code to Swift code) 3. Using C++ (which most developers are not familiar with, so option 1 & 2 are definitely our favourites) The problem: K/N is not stable right now and we are worrying how much support it will receive in the future. K/N also never has been used in any production App (apart from Jetbrain’s Conf App). My Questions: 1. Any news on a release date for a stable version of K/N? 2. Do you know any specific company which is using K/N in production? My best guess right now is, that we rather go with Swift or C++ since we can hardly base our future development on sth non-stable 💔 😕 but we would really love to if we know that K/N receives serious amount of development in the next time ❤️ 💃 It’s a big project, so we need to be considerate with our choice of technology. I did a lot of research and I only saw this rather unspecific statement of olonho: https://github.com/JetBrains/kotlin-native/issues/1166
o

olonho

06/29/2018, 2:00 PM
What exactly do you mean by "not stable"? It is pretty stable compiler and the runtime (significant part of compiler codebase is shared with Kotlin/JVM and Kotlin/JS) . It is well tested on wide variety of usecases, and maybe some of people on this channel (@thevery?) could comment on how usable it is for production outside of JetBrains. Changes that will be made for 1.0 are mostly around polishing using the technology in combination with Gradle, interoperability tweaks, library format improvements and implementing features of Kotlin 1.3 (such as unsigned types). None of those shall prevent using K/N in the production.
d

dany

06/29/2018, 2:09 PM
In my company we use it on production (shared Android/iOs code); we had few bumps along the road but it is working well (still we dont put it into core part yet so we can fallback/redo in "case of")
t

thevery

06/29/2018, 2:15 PM
We're not yet in prod but testing next version of app with first small part written in K/N (ETA is ~2weeks). Since iOS 32-bit is supported now main issue for us is tooling support (we need some gradle project format support in AppCode or simply code completion for IDEA/AS). Second one is threading/memory model, but this one is improving, too.
s

spierce7

06/29/2018, 3:19 PM
2. Using Swift and accessing it via JNI Wrapper on Android (we need to rewrite our Kotlin code to Swift code)
Down that road lies madness. I'd recommend avoiding that.
2
a

AnaR

06/29/2018, 4:35 PM
From the post, it sounds like the code is already in Kotlin. Why not just try it on iOS by compiling it using Kotlin native?
👍 3
☝️ 1
k

kpgalligan

06/29/2018, 5:17 PM
You definitely don't want to use Swift on Android. I realize everybody got excited recently with the blog post about it, but I suspect you'll be able to count on 1 hand the number of production apps released with it a year from now. Swift is stable, but Swift for Android? Also, it adds 32m+ to you apk. Horrible option. C++ is the way to go if you aren't comfortable with K/N, but not be 1.0 and not be stable aren't the same thing.
👍 2
a

amorenew

06/29/2018, 7:00 PM
Companies that use it Touchlab
@dany could you share more about your experiment in KN? benefits and obstacles
m

Malte

06/29/2018, 8:21 PM
thanks for the quick replies already! Really appreciate that. These got me a little bit more confident to give K/N a shot. @olonho I read "unstable" somewhere in a blog post but could be an older one. I will try K/N in the next weeks and hope everything works out fine with our codebase!
n

norman784

06/29/2018, 9:44 PM
I tried for a while too, only for pet projects (most related with c interop and in desktop) and didn’t find any issue in general, what you may read is that is in early access (https://github.com/JetBrains/kotlin-native/blob/master/RELEASE_NOTES.md). Also the K/N team is very responsive and helps you here or in the github repo.
👍 1
k

krtko

06/29/2018, 11:04 PM
If you are concerned about stability, I would wager Kotlin Native is going to be a lot more stable then Swift on Android/Linux will be. Have you tried Kotlin Native out on iOS yet? JetBrains has a very good track record for stability, altho pre-1.0 releases often have a lot of API changes.
👍 3
d

dany

06/30/2018, 5:50 AM
@amorenew Sure. The benefits is clearly to develop once, run everywhere (Android, Web, iOs) + to develop in Kotlin which I personally prefer rather than swift/JS. We use it strictly on logical parts of the app, so we have very few "actual/expect" declarations. The major problems we encountered qre with the integration into the iOs project. We did not want to introduce a new tool (Gradle/konanc) to all iOs developer so we develop it like a lib distributed as a framework for iOs. The setup of the framework and xcode builds in all configurations (simulator/phone/debug/prod) was the longest and hardest part. Other than that, few problems we had: some standard lib methods are not yet in KN (takeIf (OK now), shuffled), 32bit arch support (which is a WIP now) and we also got rejected by Apple (https://github.com/JetBrains/kotlin-native/issues/1642 fixed in 0.7.1) ) In the end now that it's working, we are happy with it and the setup was worth it
❤️ 2
k

kpgalligan

06/30/2018, 2:19 PM
Just be careful with the threads I guess 🙂
1
m

Malte

06/30/2018, 6:14 PM
@norman784 @dany great to hear what your experience was with K/N. That is very useful insight for us. We didn't try Swift (on Android) yet. Heard it's a considerable option as we don't really want to go with C++. Considering your replies, I am leaned towards K/N right now and cannot wait to try it out
❤️ 1