https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
r

Ryan Simon

03/28/2021, 2:02 PM
Hey all, I've got a project configuration conundrum I'm hoping someone can help me with. I'm currently evaluating KMM for my current employer, and I'm trying to figure out the best way to setup code sharing for two existing projects. My initial thought was to have my multiplatform code live in its own git repository and have it generate the libraries we need and publish them locally so the iOS and Android repositories can access them that way. The problem I ran into is a lack of documentation around this approach. It seems JetBrains encourages a mono repo setup, but we may not be able to achieve that right now. Any resources you can point me to for doing a local library approach by keeping the multiplatform code separate from the iOS and Android projects would be super appreciated. Thanks in advance!
👍 1
m

Mike

03/28/2021, 2:19 PM
For iOS you can generate frameworks and then create a fat framework to publish. There’s also a cocoa pods plug-in but due to lack of documentation (couldn’t figure out how to use export syntax) I abandoned it. For android it’s pretty straight forward to publish an artifact, just regular gradle stuff
s

Sam

03/28/2021, 2:20 PM
It really depends on the type of code sharing you want to do. If you have a module that won't change very often then you'll want to look at publishing to a private CocoaPods and maven repo. If you’re wanting to share business logic code that evolves as the app is developed, a mono repo approach is the way to go. I hate the but you could possibly get by with git sub modules. It does require that your iOS devs need to have the Kotlin tooling on their machines to make that work. CI also gets tricky if you’re using a hosted solution. Not many of the iOS CI offerings have images that can also run Java code out of the box.
r

Ryan Simon

03/28/2021, 2:30 PM
Thanks for the responses guys. It sounds like mono repo will likely be the case. Our code will evolve quite a bit as we keep building features
m

marzelwidmer

03/28/2021, 4:09 PM
@Ryan Simon I found this https://github.com/KodeinKoders/playground-alternate-KMM-architectures

https://youtu.be/u1FR90ZIlkg

maybe it helps U
r

Ryan Simon

03/28/2021, 4:28 PM
Much appreciated, I'll check these out!
p

ptsiogas

03/28/2021, 5:02 PM
@Ryan Simon you can have a look at this if you want to use Swift package manager and have 2 repositories. https://www.notion.so/desquared/Share-KMM-module-with-iOS-via-SPM-8580006dce61414980216a10a647e9f4
😎 1
r

Ryan Simon

03/28/2021, 5:45 PM
Will do, thank you
👍 1
c

clark

04/01/2021, 7:02 PM
What did you decide to go with @Ryan Simon?
r

Ryan Simon

04/01/2021, 7:04 PM
@clark I haven't made a decision just yet. Soon though! I can report back once I do
👍 1
❤️ 1
@clark just as a follow up, my team ended up going with managing our KMP shared code as a separate library that we host with a hosted nexus server then the android and ios projects just import that as a dependency into the respective projects
❤️ 1