How can i use platform specific native api without...
# compose-desktop
v
How can i use platform specific native api without Java Bridge. Like Windows Registries, MacOS System Configuration Framework. I am writing an application to share files across platform (android, ios, mac, linux and windows) Do not wish to write UI in each platform so using compose. The main app will use compose. I wish to share main app UI, business logic (domain), models, viewModel, API call to server and local database operation. The above domain layer will use the platform specific native api. The Toolbar and widget will be written in platform native.
k
Compose is on top of Kotlin which is (kinda if you squint the right way) on top of Java. If you want to call native APIs, you use JNI bindings.
👍🏻 1
v
Can I have UI JVM -> Kotlin Native -> Native Framework
a
You can through cinterop. Here’s a reddit thread where someone did that: https://www.reddit.com/r/Kotlin/comments/12vmtfb/mix_kotlin_native_with_jvmandroid_kotlin/
👍 1
v
@Alexander Maryanovsky I thing this will not work. cinterop converts static library to be used in kotlin. Use case is to use static library on JVM.