Marco
02/22/2022, 2:00 PMclass GenericClass<T> {
fun <A> clone(block: (GenericClass<T>) -> GenericClass<A>): GenericClass<A>{
return block(this)
}
}
Because currently the compiler generates this implementation that not fill my requirements because the return type is GenericClass<`AnyObject`> instead of be generic <A>
public class GenericClass<T> : KotlinBase where T : AnyObject {
public init()
open func clone(block: @escaping (GenericClass<T>) -> GenericClass<AnyObject>) -> GenericClass<AnyObject>
}
Is this implementation wrong? There is a proper way to do that? Thank you!Rick Clephas
02/22/2022, 6:33 PMAnyObject
instead of the generic A
is because ObjC doesn't support generics on functions.Marco
02/22/2022, 6:37 PM