Maybe someone will be able to point me into right ...
# kotlin-native
m
Maybe someone will be able to point me into right direction? I have several multiplatform modules in my project, which I would like to export to Xcode as frameworks. I already know it only possible to have only one multiplatform framework, so the task is to put all modules together and create a single framework from them. And this is where I stuck. Some are mentioning generating `.klib`s for each module and generate single framework from them, but is there some kind of a guide for this? Currently I’m using
packForXcode
gradle task from Kotlin tutorial (https://play.kotlinlang.org/hands-on/Introduction%20to%20Kotlin%20Multiplatform/01_Introduction). Ideal would be to modify it somehow to get several modules as input and produce one framework on output.
r
Use
packForXcode
as usual in your top-level module, and include the other modules in that one via
dependencies
block.
m
That’s what I’ve tried, but classes from sub-modules are not visible (tried with
api
)
Not visible from Xcode
r
Ah. For visibility from swift you need an extra step in your
framework
block. See "Exporting Dependencies in Frameworks" section here https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#building-final-native-binaries
m
Great, that’s probably what I was looking for. Thanks
r
Needs either an explicit
export
for each or setting
transitiveExport = true
👍
k
if you have a maven repository, then you can publish the .klibs for each module and consume them in your umbrella project, producing a fat framework, or using the cocoapods plugin
otherwise, git submodules work as well
👍 1