RxDataSources and CleanArchitecture
GlebGamaunov opened this issue · comments
Hi, I have a question related to architecture of view model and VC.
I'm want to add tvDataSource to PostsViewModel.swift. But can't understand it will be in input or in output. Now in VC i have some like:
let tvDataSource = RxTableViewSectionedReloadDataSource<SectionOfCustomData>(configureCell: { dataSource, tableView, indexPath, _ in
switch dataSource[indexPath] {
case .customData(let customData):
let cell = tableView.dequeue(Reusable.petCell, for: indexPath)
return cell
case .string(let string):
let cell = tableView.dequeue(Reusable.addItemCell, for: indexPath)
return cell
}
})
and bind this in in func VC:
output.sections
.drive(tableView.rx.items(
dataSource: tvDataSource))
.disposed(by: rx.disposeBag)
I can't understood cell we need configure in VC, but tvDataSource in viewModel. So what i need change to configure dataSource in viewModel. Because let sections: Driver<[SectionOfCustomData]>
i have in viewModel Output.
Thanks