The Swift Package Manager for Kotlin Multiplatform Plugin, aka spmForKmp
Gradle Plugin, is an alternative of the dying CocoaPods Plugin used by KMP cocoapods plugin.
It will help you to integrate Swift Package and simplify communication between Swift/Kotlin Multiplatform projects targeting the Apple platform.
The plugin uses the embedded Swift Package Manager, so no third-party dependency is needed, and it's less intrusive.
plugins {
id("org.jetbrains.kotlin.multiplatform")
id("io.github.frankois944.spmForKmp") version "[version]"
}
kotlin.mpp.enableCInteropCommonization=true
kotlin {
listOf(
iosArm64(),
iosSimulatorArm64()
// and more Apple targets...
).forEach {
it.compilations {
val main by getting {
// Choose the cinterop name
cinterops.create("nativeBridge")
}
}
}
}
swiftPackageConfig {
create("nativeBridge") { // must match with cinterops.create name
// your bridge and native dependencies
}
}
If you find this project useful, please consider giving it a star!
For additional help or detailed documentation, refer to the official repository or contact the plugin maintainers. Happy coding! 🎉