Hello, I'm using xcframework from kotlin multipla...
# multiplatform
s
Hello, I'm using xcframework from kotlin multiplatform project, it work great and the cinterop is working fine for now. The only problem i'm facing is that my project only use target iosArm64 and iosSimulatorArm64 and so generated the cinterop for them, but I can't access them from iosMain, only from iosArm64Main and iosSimulatorArm64Main. I would like to avoid to use expect/actual to access xcframework feature from iosMain ... Any idea ? Here is my config
Copy code
listOf(
    iosArm64(),
    iosSimulatorArm64()
).forEach { target ->
    target.compilations {
        val main by getting {
            cinterops {
                val myFramework by creating {
                    val libsDir = rootProject.layout.projectDirectory.dir("libs")
                    val xcfPath = "$libsDir/MyFramework.xcframework"

                    // Select proper slice
                    val frameworkPath = when (target.konanTarget) {
                        KonanTarget.IOS_ARM64 -> "$xcfPath/ios-arm64"
                        KonanTarget.IOS_X64, KonanTarget.IOS_SIMULATOR_ARM64 -> "$xcfPath/ios-arm64_x86_64-simulator"
                        else -> {""}
                    }

                    defFile(libsDir.file("MyFramework.def"))
                    compilerOpts("-framework", "MyFramework", "-F", frameworkPath, "-fmodules")
                }
            }
        }
    }
}
Thx
Found the answer in slack by enabling that in gradle conf
Copy code
kotlin.mpp.enableCInteropCommonization=true
👍 2