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
Kris Wong
03/09/2020, 1:20 PM
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
Julio Zynger
03/09/2020, 2:02 PM
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
Kris Wong
03/09/2020, 2:13 PM
also possible. cocoa library that depends on a KMP framework.
j
Julio Zynger
03/09/2020, 2:16 PM
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