I have a viewcontroller which displays a table view with complex UI and different type of data depending on certain conditions/usertype. This involves logic to segregate and process data on user selection and hide/unhide expand/close section. As I am using MVVM pattern, can my viewmodel class conform to UITableviewDelegate and UITableViewDataSource, so that I have a thinner viewcontroller?
Something like -
class HomeViewController: UIViewController {
.
.
let viewModel = HomeViewModel()
@IBOutlet weak var tableView: UITableView!
.
.
tableView.delegate = viewModel
tableView.dataSource = viewModel
}
class HomeViewModel: UITableViewDataSource, UITableViewDelegate {
//Implement delegates
}