因此,我有一个通用类FirstClass<T: SomeProtocol>
,还有第二个类(继承自NSObject
),其中包含的数组FirstClass
,并且具有返回数组元素的函数(因此返回FirstClass<T>
)。
实际上,我在语法上遇到了麻烦。
SecondClass<F>: NSObject where F == FirstCall<S>, S: SomeProtocol {}
我认为这是最能说明我要实现的宣言。
这是我的错误:Use of undeclared type 'T'
。
我想知道这是否可以通过特定的语法来实现,或者我走的路不好。
谢谢
我想你想做这样的事情
protocol SomeProtocol {
}
class FirstClass<T: SomeProtocol> {
}
class SecondClass<F,T:SomeProtocol>:NSObject where F:FirstClass<T> {
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句