因此,我有一个泛型类FirstClass<T: SomeProtocol>,还有第二个类(从NSObject继承),其中包含一个FirstClass数组,并具有返回数组元素的函数(因此返回一个FirstClass<T>)。
实际上,我在语法上有一些问题。
SecondClass<F>: NSObject where F == FirstCall<S>, S: SomeProtocol {}我认为这是一个宣言,它说明了我想要达到的最好的目标。
这里我有一个错误:Use of undeclared type 'T'。
我想知道是否可以通过一个特定的语法来实现这一点,或者我是否走了一条糟糕的道路。
谢谢
发布于 2017-02-23 14:48:23
我想你想做这样的事
protocol SomeProtocol {
}
class FirstClass<T: SomeProtocol> {
}
class SecondClass<F,T:SomeProtocol>:NSObject where F:FirstClass<T> {
}https://stackoverflow.com/questions/42418268
复制相似问题