class MyTableViewDataSource: NSObject, UITableViewDataSource { let viewModel: MyViewModel init(viewModel: MyViewModel) { self.viewModel = viewModel } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { viewModel.dataSet.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "MyCell") as! MyCell let cellModel = viewModel.dataSet[indexPath.row] cell.configure(with: cellModel) return cell } }