kotlin {
targets
.matching { it is org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget }
.configureEach {
val target = this as org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
val sdk = when (target.konanTarget) {
org.jetbrains.kotlin.konan.target.KonanTarget.IOS_X64 -> "iphonesimulator"
else -> "iphoneos"
}
rootProject.tasks
.matching { it is dev.icerock.gradle.tasks.CompileCocoaPod && it.compileSdk == sdk }
.configureEach {
val compileCocoaPod = this as dev.icerock.gradle.tasks.CompileCocoaPod
val frameworksPath = compileCocoaPod.frameworksDir
target.binaries.configureEach {
linkerOpts("-F$frameworksPath")
}
}
}
}
code from project: