ankushg
07/21/2022, 8:51 PMsealed interface MyCollectionClass {
val collection: Collection<String>
}
data class MyListClass: MyCollectionClass {
override val collection: List<String>
}
data class MySetClass: MyCollectionClass {
override val collection: Set<String>
}
Within Kotlin, when we that our concrete type is a MyListClass
, we also know that collection
is of type List<String>
But in Swift, even when we know we have an instance of MyListClass
, the type of collection
looks like a Collection<String>
I think this is only the case with `sealed interface`s — `sealed class`es seem to be working as expected.