我试图复制嵌套适配器示例,但它无效:
来自嵌套适配器示例:
private var number: Int?
func objects(for listAdapter: ListAdapter) -> [ListDiffable] {
guard let number = number else { return [] }
return (0..<number).map { $0 as ListDiffable }
}
这是我对自己班级的所作所为:
private var storie: Stories?
func objects(for listAdapter: ListAdapter) -> [ListDiffable] {
guard let storie = storie else { return [] }
return (storie as ListDiffable) as! [ListDiffable]
}
但是我无法将storie转换为[ListDiffable]