I have an android app and a Ktor backend both writ...
# multiplatform
s
I have an android app and a Ktor backend both written in Kotlin. Can I use KMM to combine them in one project and share the models? I haven't found any guides on this, is it not recommended?
m
You probably don' t need KMM for this. Build the code to share between the server and Android in a JVM module. The server and android apps will then link that library in as a project dependency (both can consume java libraries). Now if you decide you want the model classes to be useable from other platforms, then you need to make the models module KMM.
m
Yes you can definitely do it, i have an example project: https://github.com/Oztechan/CCC I share • database and database models • api and api models between android, ios and backend My backend receives and makes api calls so ktor client part is shared, and I use sqldeleight in my backend so i can share that as well