So I have a generic class FirstClass<T: SomeProtocol>
, and I have a second class (which inherit from NSObject
) where it contains an array of FirstClass
, and have functions that return element of the array (so returning a FirstClass<T>
).
Actually I am having some trouble with the syntax.
SecondClass<F>: NSObject where F == FirstCall<S>, S: SomeProtocol {}
I think this is the declaration which illustrate the best what I want to achieve.
Here I have an error: Use of undeclared type 'T'
.
I would like to know if this could be achieve with a specific syntax or if I take a bad path.
Thank you
I think you want to do something like this
protocol SomeProtocol {
}
class FirstClass<T: SomeProtocol> {
}
class SecondClass<F,T:SomeProtocol>:NSObject where F:FirstClass<T> {
}