我有以下代码:
protocol NextType {
associatedtype Value
associatedtype NextResult
var value: Value? { get }
func next<U>(param: U) -> NextResult
}
struct Something<Value>: NextType {
var value: Value?
func next<U>(param: U) -> Something<Value> {
return Something()
}
}
现在,问题Something
在于next
. 我想返回Something<U>
而不是Something<Value>
.
但是当我这样做时,我得到了以下错误。
type 'Something<Value>' does not conform to protocol 'NextType'
protocol requires nested type 'Value'