Multi Target Configuration
Configuration By Target
You can set a different configuration for each target you manage.
build.gradle.kts
kotlin {
listOf(
iosArm64(),
iosSimulatorArm64()
).forEach { target ->
target.swiftPackageConfig(cinteropName = "nativeIosShared") {
// your embedded swift is inside the folder src/swift/nativeIosShared
// your config for iOS
}
}
}
kotlin {
macosArm64 {
swiftPackageConfig {
// your embedded swift is inside the folder src/swift/macosArm64
// your config for macOS
}
}
}
Legacy (< 1.1.0)
build.gradle.kts
listOf(
iosX64(),
iosSimulatorArm64(),
).forEach {
it.compilations {
val main by getting {
cinterops.create("nativeIosShared") // a config for iOS
}
}
}
listOf(
macosArm64(),
).forEach {
it.compilations {
val main by getting {
cinterops.create("nativeMacosShared") // a config for macos
}
}
}
swiftPackageConfig {
create("nativeIosShared") {
// your embedded swift is inside the folder src/swift/nativeIosShared
// your config for iOS
}
create("nativeMacosShared") {
// your embedded swift is inside the folder src/swift/nativeMacosShared
// your config for macOS
}
}