Edouard Goossens

07/03/2018, 9:32 PM
Hi everyone, I’m trying to extract common code for my app’s data (models, basically just Kotlin data classes) and repository layers. 1/ I’d like to have the data layer available in iOS as a framework generated with Konan, and as a direct dependency in other platforms. I don’t have “expect” declarations there so maybe there’s a way to handle this without multiplatform? 2/ I’d like to share the repository logic (HTTP and Firebase) between the backend (Ktor/JVM), Android and later React JS apps. As I’m going to use specific libraries in each platform for HTTP and Firebase I want to use the expect/actual mechanism here. I’d also like to use Kotlin serialization and coroutines as much as possible. iOS will still have it’s own repository layer written in Swift until Multiplatform supports Kotlin/Native better. Does this make sense? Has anyone done something similar? How can I make the repository layer depend on the data layer? Thanks!


07/06/2018, 5:04 AM
Yes this is possible and I have done it with the JVM, Android, and the web. I haven't tried out Kotlin Native and iOS yet as its still alpha.
It can be kinda tricky at first structuring your API to be able to adapt to each platform