0

我正在尝试将单个UITableView与 2 个数据源绑定。我的代码是这样的

viewModel?.dataSource?.currentYear?.bind(to: tableViewMonths, cellType: StatementExportMonthTableViewCell.self) { (cell, name) in
            cell.updateWith(month: name)
        }

viewModel?.dataSource?.previousYear?.bind(to: tableViewMonths, cellType: StatementExportMonthTableViewCell.self) { (cell, name) in
            cell.updateWith(month: name)
        }

我不知道如何根据选定的段索引将正确的数据显示到表视图中。我知道我可以定义一个主要数据源,并且根据段选择,我应该将相应的数据源分配给该实例并从中重新加载 tableview。

但是,如果 Bond 已经内置了该功能,我会尝试简化它。

在这里的任何帮助将不胜感激。

谢谢

4

0 回答 0