Good morning multiplatform trailblazers!!! I have ...
# multiplatform
m
Good morning multiplatform trailblazers!!! I have a very noob question but i get mixed signals from the Internet. I can read here and there it’s possible to have access to generics from swift code by activating the
Xobjc-generics
flag on the compiler. That being said i keep having my type erased on the swift side and have to deal with a
Any?
instead. The type im trying to use is the
Result
type. Do you have any idea if it’s possible? Do I have to write my own
Either
type?
r
Kotlin generics and Objective-C generics aren’t completely compatible, so only a subset of what you can do in Kotlin can be converted to Objective-C. Swift is a little closer to Kotlin while still not 1-1, but in K/N we’re doing ObjC, not Swift anyway
r
Some notes on the implementation and what is and isn't possible here: https://medium.com/@kpgalligan/kotlin-native-interop-generics-15eda6f6050f
In short, there still are a bunch of scenarios where you might need to cast because all three languages handle generics differently
m
Thanks. Was very helpful