// ViewimportUIKitimportRxSwiftimportRxCocoaimportRxDataSourcesclassMainViewController:UIViewController,Injectable{typealiasDependency=MainViewModel@IBOutletprivateweakvartableView:UITableView!privateletdisposeBag=DisposeBag()privatevardataSource:RxTableViewSectionedReloadDataSource<SectionModel>!privateletviewModel:MainViewModelrequiredinit(withdependency:Dependency){viewModel=dependencysuper.init(nibName:nil,bundle:nil)}@available(*,unavailable)requiredinit?(coderaDecoder:NSCoder){fatalError("init(coder:) has not been implemented")}overridefuncviewDidLoad(){super.viewDidLoad()// Do any additional setup after loading the view.tableView.register(CustomTableViewCell.self,forCellReuseIdentifier:"Cell")dataSource=RxTableViewSectionedReloadDataSource<SectionModel>(configureCell:{_,tableView,indexPath,iteminletcell=tableView.dequeueReusableCell(withIdentifier:"Cell",for:IndexPath(row:indexPath.row,section:0))cell.textLabel?.text=item.0cell.accessoryType=.disclosureIndicatorreturncell},canEditRowAtIndexPath:{_,_inreturntrue})//////// ↓問題はココ /////////////////////////////////////////////////////////////////////viewModel.dataRelay.subscribe(onNext:{[weakself]recordsinguardletstrongSelf=self,letitems=records.first?.itemselse{return}letdata=[SectionModel(items:items)]Observable.just(data).bind(to:strongSelf.tableView.rx.items(dataSource:strongSelf.dataSource)).disposed(by:strongSelf.disposeBag)}.disposed(by:strongSelf.disposeBag)})//////// ↑問題はココ /////////////////////////////////////////////////////////////////////tableView.rx.itemDeleted.subscribe(onNext:{[weakself]indexPathinguardletstrongSelf=selfelse{return}Observable.just(indexPath).bind(to:strongSelf.viewModel.requestDeleteRecordStream).disposed(by:strongSelf.disposeBag)}).disposed(by:disposeBag)}}