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

Vladimir Vainer

09/21/2023, 12:44 PM
I have a kmm library project baseLib that defines a class Widget. I have a Swift library project sdk that uses baseLib project, and provides functions like drawWidget(widget) And i have an Android library project ASdk that also uses baseLib project and provides drawWidget(widget) function. Now i want to create another kmm library project, that will use baseLib, and inside there define a bunch of widgets. Which i can use from both iOS and Android. How can i achieve this? This seems impossible. I cannot put the widgets inside baseLib.
r

ribesg

09/21/2023, 1:06 PM
I don't see an issue?
v

Vladimir Vainer

09/21/2023, 1:18 PM
iOS App links to xcframeworks: SDK AwesomeWidgets SDK links with BaseLib And AwesomeWidget links with BaseLib. In The App i have: SDK.Widget And AwesomeWidget.BLWidget And en error: Cannot convert value of type BLWidget to Widget
r

ribesg

09/21/2023, 2:13 PM
Unless that changed, you can't use multiple KMP dependencies in an iOS project. You need an umbrella library.
The umbrella project is mostly a Gradle file. Gradle will handle dependencies conflict resolution and produce a single dependency without conflicts. Think about it: you might have multiple kmp libs depending on different versions of stdlib, coroutines, serialization, your own lib, etc. You need something to resolve all of that at some point. Gradle does that.
v

Vladimir Vainer

09/21/2023, 2:17 PM
Sounds good, I'll look into that
2 Views