【发布时间】:2019-09-26 22:02:03
【问题描述】:
如果我们有一个Foo: Decodable 类型,我们如何让Array<Foo> 可解码?
我是否必须创建另一个类型 Foos: Decodable ?
如果是这样,这将如何工作?
我在这里看到了问题
func exampleMethod<T:Decodable>(type: T) { }
// Argument type 'Array<Foo>.Type' does not conform to expected type 'Decodable'
exampleMethod(type: [Foo].self)
【问题讨论】:
-
您的方法正在等待一个实例,您正在尝试传递类型。