![](/img/trans.png)
[英]Instance method 'items' requires that 'listen' conform to 'Sequence'
[英]Instance method 'items(cellIdentifier:cellType:)' requires that 'Model' conform to 'Sequence'
我正在编写一个代码,在表格视图中显示我从服务器收到的值。 但是,会出现以下错误: 实例方法 'items(cellIdentifier:cellType:)' 要求 'Model' 符合 'Sequence' 这是我的代码。 我不知道为什么会出现错误。
rank.bind(to: tableView.rx.items(cellIdentifier: "rankingCell", cellType: RankingCell.self)) { rkc, model, cell in
cell.nickNameLbl.text = model.nickName
cell.profileImage.image = model.profileImage
cell.Ranking.text = model.profileImage
}.disposed(by: disposeBag)
这是我的 viewController 的 rx 部分出现错误。
struct RankingModel: Codable {
var ranking: Int = -1
var nickName: String = ""
var profileImage: String = ""
enum RankingModelKeys: String, CodingKey {
case ranking
case nickName
case profileImage
}
}
这是我的 model
表格视图显示值的数组(序列)。 编译器告诉您您的 model 不是数组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.