If I wanted to compile Kotlin code in Compose Mult...
# multiplatform
s
If I wanted to compile Kotlin code in Compose Multiplatform, how should I approach it? I don't want to embed
kotlin-compiler-embeddable
as its size is very high for a mobile app to support
c
Sounds like an XY-Problem. What do you want to achieve and why would you like to compile Kotlin code yourself?
s
It isn't XY problem, as I am creating an app where I want the user to have the power to edit small parts of code and compile it themselves. I have JS support in the app, since running WebView is easy and compiling there is easy. Now I'd like to add Kotlin support. I was thinking I could create a BE where I could compile it, but maybe there are some other ways to do it
c
I think you‘ll have problems on iOS with Apples guidelines if you do it in the device. Also I don’t think there is an Kotlin compiler for iOS.
s
Gotcha. Thanks
c
You probably won't be able to run the compiler directly inside an app, since it depends on a proper JDK and a whole bunch of other stuff. Instead you might look into using a remote server to do the actual compilation and execute the code. Here's the one that powers https://play.kotlinlang.org https://github.com/JetBrains/kotlin-playground
❤️ 1
s
Much appreciated! I’ll use this then. I have Monaco editor (VSCode) embedded to a webview, but to support Kotlin I think I’ll need to have two separate editors. My main goal is to support JS and Kotlin for now:) Thanks again~