Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
TableViewDataSource in SourcesTableViewController
class SourcesTableViewController : UITableViewController {
private var webservice :Webservice!
private var sourceListViewModel :SourceListViewModel!
private var dataSource :TableViewDataSource<SourceTableViewCell,SourceViewModel>!
override func viewDidLoad() {
private func updateUI() {
self.webservice = Webservice()
self.sourceListViewModel = SourceListViewModel(webservice: self.webservice)
// setting up the bindings
self.sourceListViewModel.bindToSourceViewModels = {
private func updateDataSource() {
self.dataSource = TableViewDataSource(cellIdentifier: Cells.source, items: self.sourceListViewModel.sourceViewModels) { cell, vm in
cell.nameLabel.text =
cell.descriptionLabel.text = vm.body
self.tableView.dataSource = self.dataSource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment