TableViewでRxSwift/RxDataSourceを使用しようとしていますが、configureCellに既存の関数を割り当てることができません。以下のコード:RxSwift DataSource configureCellが関数を割り当てることができません
import UIKit
import RxSwift
import RxCocoa
import RxDataSources
class BaseTableViewController: UIViewController {
// datasources
let dataSource = RxTableViewSectionedReloadDataSource<TableSectionModel>()
let sections: Variable<[TableSectionModel]> = Variable<[TableSectionModel]>([])
let disposeBag: DisposeBag = DisposeBag()
// components
let tableView: UITableView = UITableView()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
setDataSource()
}
func setupUI() {
attachViews()
}
func setDataSource() {
tableView.delegate = nil
tableView.dataSource = nil
sections.asObservable()
.bindTo(tableView.rx.items(dataSource: dataSource))
.addDisposableTo(disposeBag)
dataSource.configureCell = cell
sectionHeader()
}
func cell(ds: TableViewSectionedDataSource<TableSectionModel>, tableView: UITableView, indexPath: IndexPath, item: TableSectionModel.Item) -> UITableViewCell! {
return UITableViewCell()
}
func sectionHeader() {
}
}
Xcodeのは、次のエラーがスローされます。エラーがライン
dataSource.configureCell = cell
でスローされ
/Users/.../BaseTableViewController.swift:39:36: Cannot assign value of type '(TableViewSectionedDataSource, UITableView, IndexPath, TableSectionModel.Item) -> UITableViewCell!' to type '(TableViewSectionedDataSource, UITableView, IndexPath, TableSectionModel.Item) -> UITableViewCell!'
あなたはどんな考えを持っていますか?
おかげ
プットのdataSource ViewModelのセクションオブジェクト – denis631