Hello mates, while using Kotlin Multiplatform I ca...
# kotlin-native
Hello mates, while using Kotlin Multiplatform I came across a following issue in Swift. In kotlin we have awesome feature like
type, I was trynna use it with generics in entity like
Copy code
sealed interface Either<out TLeft, out TRight> {
    class Failure<T>(...) : Either<T, Nothing>
    class Success<T>(...) : Result<Nothing, T>
This is cool approach in Kotlin and everything works fine:
Copy code
val result: Either<Entity, Error> = result as Success<Entity>
BUT in swift I can't do stuff like this:
Copy code
guard let result: Either<Entity, Error> = result as? Success<Entity> else { return }
This will break at runtime, since swift generics aren't erased, and it won't pass type check (
). Any ideas how to workaround it? cc @alex009
👍 1
👀 1
The real example is slightly different and you can check it here: https://github.com/icerockdev/moko-mvvm/pull/152