Good morning, As part of a multiplatform kotlin pr...
# multiplatform
i
Good morning, As part of a multiplatform kotlin project, how can I share two kmp modules with the iosApp project ?
p
You can have the 2 modules produce an
.xcframework or .framework
each, and then import them in the iosApp Xcode project independently. However, that will duplicate the KMP runtime in each framework increasing App size and may lead to name clashes in some of your classes too. The recommended approach is using one umbrella framework. Traditionally this umbrella module is named
shared
or
composeApp
more recently. The umbrella module would group all the modules your project has and will export them in a single
.framework
file that you integrate in your Xcode project.
1
i
Thank you for your response, in fact I was able to import both modules but when I used both modules at the same time I got this error on the iOS app side.
p
Yeah is complaining about
runtime injected twice
You would have to go the umbrella approach or try to compile against the Kotlin runtime
dynamically
. That way it is not included in your binary but expected to be provided by the system at runtime.
l
i
Thanx
👍 1