
var dataList = BehaviorSubject(value: [SectionModel
//1.tableView创建数据源
let dataSource = RxTableViewSectionedReloadDataSource
_, tableView,indexPath,element in
let cell: ServiceRxImageCell = tableView.dequeueReusableCell(withIdentifier: "ServiceRxImageCell") as! ServiceRxImageCell
if element is Detail {
cell.viewModel = element as? Detail
}
return cell
}
})
//2.绑定数据
dataList.asObserver().bind(to: tableView.rx.items(dataSource: dataSource)).disposed(by: disposeBag)
//3.初始化显示数组
let sectionModel = SectionModel.init(model: "", items: array)
dataList.onNext([sectionModel])
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)