'RxSwift cell register failure

I use the MVVM architecture and after setting everything up there is no cell in the TableView and breakpoints in the cell file will not get hit.

In my code: controller:

 private lazy var tableView: BaseTableView = {
        let tableView = BaseTableView()
        tableView.register(MyCell.self, forCellReuseIdentifier: String(describing: MyCell.self))
        tableView.rowHeight = 148
        tableView.estimatedRowHeight = 148
        self.view.addSubview(tableView)
        tableView.snp.makeConstraints { (make) in
            make.top.bottom.left.right.equalToSuperview()
        }
        return tableView
    }()

let dataSource = RxTableViewSectionedReloadDataSource<MytSection>(configureCell: {(datasource, tableView, indexPath, model) -> UITableViewCell in
            let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: MyCell.self), for: indexPath) as! MyCell
            cell.model = model
            return cell
        })

viewModel.output
            .items
            .map { [MySection(header: "", items: $0)] }
            .bind(to: tableView.rx.items(dataSource: dataSource))
            .disposed(by: bag)

The breakpoint in the cell file was not triggered. I think the cell was not called, but my delegate and datasource are both bound properly.

I'd like to know why.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source