I have a project to develop a shared KMM library m...
# multiplatform
c
I have a project to develop a shared KMM library module. However, it needs to use both Sqldelight and Ktor, which are also used by our main shared common code module for the app. How can I use the same Sqlight and Ktor dependencies for both multiplatform library iOS frameworks and not duplicate the dependencies?
👀 1
k
2 Frameworks? You can’t. they are distinct at a binary level. You’d need to create an umbrella framework including both modules, or you have duplicates (however, the compiler only includes referenced code, so you don’t necessarily get the whole library as a duplicate, but in situations like sqldelight, I don’t imagine there would be much of a difference)
c
Thanks, Kevin! Do you have any good examples of integrating umbrella frameworks like this for transitive dependencies?
k
None that are public. We’ve done this a bunch for clients. You basically create a kotlin module that has project dependencies on the other modules. Then export the modules, but I would not export transitively as that pulls in everything and will inflate the final binary with unnecessary code. If I think of a good public example I’ll send it along.
c
Awesome, I'll look tomorrow as well. I spent this afternoon Googling for some.
n
I walk through how we set this up in this post. We are using transitive export so you might want to play with that part of the configuration but it could at least be a jumping off point https://engineering.premise.com/kotlin-multiplatform-project-structure-brownfield-applications-58038800a6ea
m
I had the same problem and just created a umbrella framework. It is still in PR but if you want to see some code pieces: https://github.com/Oztechan/CCC/pull/1205/files just check the
provider/build.gradle.kts
provider
module is it combines
client
and
analytics
modules and provide it to
ios
with cocoapods