I have a weird issue calling into Kotlin Code from...
# ios
h
I have a weird issue calling into Kotlin Code from iOS:
Copy code
class Foo {
   fun canCallThis(param: String) {}
   fun canNotCallThis(param: SomeLibraryClass) {}
   fun canActuallyCallThis(param: Any) {
      param as SomeLibraryClass
      // param is usable here
   }
}
Having any builtin, or class declared in the project, or even iOS foundation classes as parameters works without a problem. As soon as I have some thirdparty library type as a parameter, XCode can not see the declaration (it shows up correctly in the generated header). I'm sure that all the libraries are correclty declared and included, because the third function actually works. Just declaring the type as Any makes the function visible and callable in XCode again, and after casting I can use the object as expected.
a
You need either to export your library or do a trick: add line
fun SomeLibraryClass.foo() {}
somewhere in iosMain.
h
I do already export the related project dependencies, but
SomeLibraryClass
is from a cocoapod dependency. All types from such dependencies seem to not be usable in the ios <--> kotlin interop interface. Any clues?