Suppose I have a KMP project with a Kotlin Native ...
# kotlin-native
j
Suppose I have a KMP project with a Kotlin Native target, is it possible to include “more files” other than Kotlin? Concretely, I want to include a manually written Objective-C or Swift facade class to sit on top of the generated KN headers. Is that something supported?
k
No, you can't add swift or Obj-C in a KMP project. You can, however, use an Obj-C dependency in a KMP project via cinterop.
j
Thanks for the answer. Unfortunately I think using a dependency defeats the purpose of what I want to build. Instead of having something below the KMP code, I want something above, in other words, the facade needs to know the underlying KMP API
k
also possible. cocoa library that depends on a KMP framework.
j
Oh ok, that could do it. I don’t have a lot of experience with CocoaPods but I assume transitive dependencies are a thing, so I could make my app depend on the Swift lib that in turn depends on the KMP proj. As long as “app” doesn’t explicitly know about “KMP proj” I’d consider this an ok solution
👍 1