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

Mejdi

04/07/2021, 2:08 PM
Hey! I am integrating an iOS SDK into my KMM library. Though build works fine, I am facing issues with compilation: Compiler doesn’t resolve my new iOS package import. (that same code I can build as I mentioned) is there anything you can point me towards to solve such issue ?
So this actually solved it: It seems to be a current limitation. To get any code that uses an iOS package dependency you need to have it part of
iosX64Main
and
iosArm64Main
source sets. You can still use other iOS actulation implementations as part of
iosMain.
As per the docs we need to define the dependencies btw source sets like this:
Copy code
val iosX64Main by sourceSets.getting
        val iosArm64Main by sourceSets.getting
        val iosMain by sourceSets.creating {
            dependsOn(commonMain)
            iosX64Main.dependsOn(this)
            iosArm64Main.dependsOn(this)
        }
And instead of defining your iOS package dependency as part of
ios()
target shortcut, we need to have to split targets:
iosArm64
and
iosX64
. Before getting compiler to recognize your iOS package you need to first build the project.