Hello everyone.
I am trying to build a framework that relies on generics heavily.
The problem I'm facing is that methods outputting opaque types can't be inherited, so I thought, well, I shall extract those requirements into protocols with associated types.
But here's another problem, the following code does not compile:
open class GenericClass<T1: Hashable, T2: Hashable> { }
public protocol GenericProtocol<T1, T2>: GenericClass<T1, T2> { // ERROR: Cannot find type 'T1' in scope
associatedtype T1: Hashable
associatedtype T2: Hashable
}
So I think my approach is bad. Or is it not?
What next steps would you advice?
Thanks.