rx-swift - 使用 RxTableViewSectionedReloadDataSource 配置单元格时如何设置单元格委托
问题描述
我有一个委托方法,我想在点击单元格中的按钮时执行该方法。我使用 RxTableViewSectionedReloadDataSource 配置了我的单元格,当我在此处设置委托时,它说它们是我不理解的不相关类型,因为我的 viewController 继承了委托并实现了它的方法。
let notificationsDataSource = RxTableViewSectionedReloadDataSource<SectionOfCustomData>(
configureCell: {dataSource, tableView, indexPath, item in
guard let cell = tableView.dequeueReusableCell(withIdentifier: "NewNotificationTableViewCell", for: indexPath) as? NewNotificationTableViewCell else { return UITableViewCell() }
cell.configureCell(item: item, indePath: indexPath)
cell.notificationDeleteDelegate = self
return cell
})
我收到此错误“无法分配类型'(NotificationViewController)->()-> NotificationViewController'的值来键入'TableViewCellDeleteDelegate?'”
解决方案
似乎 NotificationViewController 不符合 TableViewCellDeleteDelegate ......
extension NotificationViewController: TableViewCellDeleteDelegate {
// TableViewCellDeleteDelegate Methods here
}
推荐阅读
- c - 函数返回和赋值之间的语义差异
- javascript - D3 JS中的折线图路径未正确显示
- xml - 无法解析自定义 xml 架构中的符号“xhtml.div.type”
- tcp - LWIP 数据包长度
- python - 从 Pandas Dataframe Column 中删除重复的逗号,换句话说,我只需要列中的文本,用逗号分隔它们
- android - 使用改造上传 pdf 和图像文件
- flutter - Flutter Launcher 图标不会改变图标
- pyspark - ValueError:未能找到可以处理输入的数据适配器:
, - excel - Excel:在 COUNTIF 内嵌套 IF 条件?
- azure-pipelines - MS Teams 无法订阅 Build Complete - 出了点问题,请稍后再试