Colton Idle
08/11/2024, 2:02 AMSkaldebane
08/11/2024, 9:46 PMcommonMain
. Since abstractions for platform-specific code would be already ready, it should be as simple as adding expect
to them in common code, and adding actual
to the implementation.
Then it's time to enable whatever other targets you wanna support. Desktop should be the easiest to begin with, then iOS, then web. Doing it one-by-one is better to not get lost xD. Overall this step may be extremely trivial or a little complicated depending on how tied to the OS your application is. You might have to modify the expect/actual
abstractions and some common code as you're doing this, since some functionalities may be very different or unavailable on certain platforms (e.g. I've had lots of headaches with JS/Wasm's lack of a file system).
Just my two cents, I myself am still in the first step, so this is purely a theoretical roadmap, so take it all with a grain of salt.
My app is a Compose app. but the biggest hurdle that it's dealing with files (so java.io.File
and Android Storage Framework) and folders (picking folders to scan them for certain files). There's Firebase Crashlytics and AdMob, but these are easy to replace. Other than that, everything else is pure Kotlin.
I'd imagine for most apps that are simply frontends that request and show data from a server (say, a restaurant app), moving to KMP may not require any platform-specific code at all, especially with the rich ecosystem, especially between Android and iOS.