If the .xcframework is published with CocoaPods, the Kotlin/Native
CocoaPods Gradle plugin will generate C interop for you. But you can also do this manually with a local .xcframework.
The docs describe doing this for a C library, but it works similarly for Objective-C. You need to define a
.def file, by default located in
src/nativeInterop/cinterop. It'll be something like this:
language = Objective-C
modules = ModuleName
linkerOpts = -framework FrameworkName
Then configure the C interop for the compilation. Something like this:
targets.withType<KotlinNativeTarget>().configureEach {
if (konanTarget.family.isAppleFamily) {
val main by compilations.getting
main.cinterops.create("defFileName") {
includeDirs("path/to/framework/headers")
}
}
}