https://kotlinlang.org logo
m

mac

09/14/2023, 1:48 AM
Confusing myself here with Kotlin multiplatform: how can I call kotlinx.browser from Kotlin/js and get that code compiled into Kotlin/native (e.g., mingw). Can I use a wasm-js target and then load that wasm artifact in native?
j

jw

09/14/2023, 2:13 AM
If you're bringing along a standalone WASM runtime and setting that up, or building on top of something like V8 then sure
The Kotlin/native code sets up the runtime and then separately you'll build a WASM artifact that you can load into it.
m

mac

09/14/2023, 2:32 AM
Ah ok yeah thanks
I forget that there's not a universal embedded browser in Kotlin multiplatform
Which is strange since jetbrains already embedded chromium in intellij -- so why not do it for kotlinmp
j

jw

09/14/2023, 2:34 AM
Kotlin multiplatform is just a compiler + stdlib. It's nowhere near even drawing pixels let alone something as complex as rendering a whole webview
m

mac

09/14/2023, 2:35 AM
Looks like I'll need to either bundle JCEF, find another Kotlin mp webview lib, or just bite the bullet and build multi-platform app like the docs do: with a folder for each runtime
It just feels counterintuitive to create folders for iOS main Android main etc when I just want to wrap a webview in a native runtime per platform
j

jw

09/14/2023, 2:36 AM
Right but with what UI toolkit on each platform? It's not like there's one built in. Are you doing Qt? Gtk? Are you doing the platform-native tookit for each platform?
Kotlin multiplatform is a mechanism of compiling code to different backends to run in different execution modes that are native to various platforms (JS, JVM, native, etc.). It's not an application framework.
m

mac

09/14/2023, 2:38 AM
Or just give up on Kotlin and stick to PWA/js
I've got some js but the requirement is to have native apps
Looks like compose multiplatform already bundled chrome for desktop and somehow supports androidx.browser on iOS and Android
j

jw

09/14/2023, 3:02 AM
is that a native app? it runs the JVM and a UI toolkit that is bundled on every platform.
m

mac

09/14/2023, 3:03 AM
Yeah I know it's not ideal
Just trying to balance limited development resources
Pure js -> browser could be ok but blink / gecko / webkit might as well be different platforms
j

jw

09/14/2023, 3:07 AM
well you're getting webkit on iOS no matter what you do
m

mac

09/14/2023, 3:07 AM
Oh they will still block my app store app if it bundles chromium embedded?
The app store monopoly needs to be crushed , frfr