Hello I'm trying to make a desktop app using compo...
# multiplatform
m
Hello I'm trying to make a desktop app using compose multiplatform which works on mac, win and linux. However, I need to call the OS specific APIs. if possible any github example or any article available please send me here. Thanks in advance
r
So your project only uses the JVM build target, is that correct?
m
yes only window, mac, linux
r
I'm no expert, but... If your only build target is JVM, then you would do OS-specific things in mostly the same way that a plain Java project would. Your first resort should be using JVM libraries that have already abstracted away the OS, but depending on what exactly you need, those may not exist yet. Here are some docs about desktop-specific tools that Compose Desktop already has abstracted for you: https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-desktop-components.html If you do have to differentiate between OS, you can manually check what OS you're on and then use
ProcessBuilder
to run platform-specific commands. There's also JNI which seems relevant, but I personally have no experience there. What sorts of OS-specific APIs do you need to use?
m
i have some library work it window and library but not work mac os. if possible use swift for mac os. that why i need os-specific code
like expect/actual in compose multiplatform but i os-specific need for window, linux, mac.
i not much experience for desktop so, that why i need some github examoke or article finding
I think it depends a lot on what exact native libraries or system APIs you're trying to use and what interfaces they expose.
m
oh thanks for sharing