Generic interfaces are not supported.
Let's describe an interface with a Kotlin generic:
interface SocketConverter<T : Any> {
fun convert(element: String): T
}
When interopping, information about the generic on this interface is lost, this can be seen from .h
the file:
__attribute__((swift_name("SocketConverter")))
@protocol SharedSocketConverter
@required
- (id)convertElement:(NSString *)element __attribute__((swift_name("convert(element:)")));
@end
But generics are not yet supported on interfaces. In Swift itself, you can create a protocol with a generic parameter.