Is it finally time to say goodbye to ugly Objective-C wrappers for Kotlin shared code in our Kotlin Multiplatform apps? 🚀 Even though we started working with KMP less than a year ago, I still believe we are in the group of early adopters of this technology. Until now, we have used KMP to build two different apps which have roughly 80 downloads per day 📈 With that being said, during this year, one of the main issues of our iOS team had with debugging the compiled shared code was that KMP is currently generating Objective-C headers from Kotlin code 🤔 We are aware that Google will release Swift interoperability during this year, but I always thought to myself, there has to be a better way to do it. And, totally by accident, I found it today 💡 So apparently, there is a framework: https://skie.touchlab.co/, which can be used in KMP projects to generate Swift code based on generated Objective-C headers 🤯 I still didn’t try it out, but I plan on doing it in the upcoming week. Community developed frameworks rock 🤘🏻
This lib is an amazing step forward but it has limitations too. Multiplatform will only be relevant for big projects on iOS only when we get Swift generated code and we can build SPMs in pure Swift, without packaging all the kotlin std lib in each .Framework.
Been using SKIE for a while and it's been a huge help on making Swift code more Swift like when using KMP. Looking forward to Swift native outputs for KMP though!
Senior Software Engineer I (iOS) at LetsGetChecked
8moIt's a decent helper, I used to solve some annoying conversions from Kotlin's enums and sealed classes that would require adding extensions in the iOS side to work with them in a "Swifty" way, but still it's not a silver bullet (check the docs for the limitations, they're really good and explain with examples what problems they actually solve). Headers in ObjC will still be there anyway because in the end it is the Kotlin compiler that creates the iOS frameworks. They also have a good library for publishing. But yeah, looking forward to the promised kotlin to Swift interop. https://skie.touchlab.co/features/