Is it possible build Apple Framework in multiplatf...
# multiplatform
a
Is it possible build Apple Framework in multiplatform project with generics support? Currently all generics converted to type Any? Nothing helps.
r
Kotlin -> Native generics are not supported
This is an incomplete implementation iirc, and I guess it should be part of 1.3.40
a
I found this post: https://medium.com/@kpgalligan/kotlin-native-interop-generics-15eda6f6050f and also this article https://github.com/JetBrains/kotlin-native/blob/master/OBJC_INTEROP.md both recommend to add this to build.gradle compilations.main { outputKinds("framework") extraOpts "-Xobjc-generics" }
r
Yes but you need to use Kotlin 1.3.40
I don’t think it’s in 1.3.31
k
That post was an overview of the plan before implementing. It’s mostly correct, but I need to do another post I think
Not sure how to comment on the completeness. I think it’s as complete as we can make it with Objc. No generic methods for example. You do need to wait until 1.3.40
r
Yes that’s what I meant by incomplete, it doesn’t match JVM Kotlin Generics capabilities and never will (if I understood correctly)
But it’s far better than what we currently have, nothing
k
Yeah, Kotlin, Swift, and Objc are all different. Even with direct Swift interop there would be some features added and removed. Swift has generic functions, but no variance. Objc does have variance, and even though Swift doesn’t recognize it, if you’re talking to an Objc class from Swift, it’s looser with casting around variance issues. Yada yada, yes, unless Swift adds the generic features found in Kotlin, support will be constrained