Hi !
I’m currently working on a KMM library that is implemented in Swift.
So there’s something I don’t really get with generics.
I have my KMM generic class:
class Foo<T> {
...
}
Then, i can use it without any problem in KMM, for example like that
var bar = Foo<List<SomeClass>>()
The problem:
This is a little different when I use it in swift, cause when I compile my KMM lib as a Swift Framework, my class is now declared this way:
public class Foo<T> : KotlinBase where T : AnyObject {
...
}
And here, I cannot use it with Arrays as I do in KMM because a Swift Array is not Any but AnyObject. For example:
var bar = Foo<[SomeClass]>()
and then i got the error:
‘Foo’ requires that ‘[AnyObject]’ be a class type
Question:
Is it possible to force something so that KMM Any is interpreted in Swift as Any and not AnyObject, or is there another solution to this problem ?