Hi all, I am starting a Kotlin - Multiplatform for...
# kotlin-native
s
Hi all, I am starting a Kotlin - Multiplatform for an Android and iOS app. I was wondering what the best way is to separate the code base in to different Repositories in stead of having 1 code base. I was thinking of having 1 Repository for the Android App and having the Shared Framework and iOS app as GitSubmodules. Even having the shared iOS code in a separate repository and using the shared framework as a CocoaPod or Swift Package.
k
that sounds like an odd structure to me. 1 repo for each app, 1 repo for each shared module
your workflow for each module will dictate how to bring in the dependencies
ideally you can utilize maven and cocoapods
however, keep in mind you can only have one MPP dependency per iOS app
s
That would be ideal, but doesn’t the Android build the shared code ?
k
no
gradle builds the shared code
s
True but if I have a seperate project to build the Shared Code and 1 for the android app don’t I have to Switch projects al the time?
I have my project structured like the example
k
you can have 2 projects open at once. in fact, I use AS for android projects and IDEA for MPP.
shared module development is the trickiest bit to enable. I have some thoughts on that as well.
s
So best is to:
Copy code
Shared Code Framework
Android App with Shared Code Framework Library
iOS App with Cocoapod or SPM with Shared Code Framework Library
k
yes, but you have several options for bringing everything together
s
I’m pretty new to Android Studio and Kotlin so I’ll have to figure out how to create the Framework.
thanks
k
@S Korebrits maybe this could help you: https://github.com/Ekahau/khtf
s
That looks great! Thanks will have a look at it.