Search code examples
kotlin-multiplatformkmm

Kotlin Multiplatform: How to call getOriginalKotlinClass from swift?


How to get Kotlin Class from swift code? I need it for dependency inection. In documentation it says that there's a method getOriginalKotlinClass, but where can I get it?

For example I have an object that is available in swift from Kotlin library JsonCacheClient, how do I get its kotlin class?


Solution

  • Try creating a method in Kotlin, which calls getOriginalKotlinClass, expose it and call this method from Swift.

    See this comment for more info