更新时间:2022-05-16 21:44:45
您不能拥有类型为Adjustable
的项目数组,因为Adjustable
并不是真正的类型.这是一张蓝图,描述了一组类型,每个T
的可能值中的一个.
You can't have an array of items of type Adjustable
, because Adjustable
isn't really a type. It's a blue print that describes a set of types, one per every possible value of T
.
要解决此问题,您需要使用类型橡皮擦 https://medium.com/dunnhumby-data-science-engineering/swift-associated-type-design-patterns-6c56c5b0a73a
To get around this, you need to use a type eraser https://medium.com/dunnhumby-data-science-engineering/swift-associated-type-design-patterns-6c56c5b0a73a