Skip to content

Instantly share code, notes, and snippets.

@nalexn
Created October 18, 2019 09:15
Show Gist options
  • Save nalexn/c67c67d9ad026c283dc4db45b793bb20 to your computer and use it in GitHub Desktop.
Save nalexn/c67c67d9ad026c283dc4db45b793bb20 to your computer and use it in GitHub Desktop.
class PodcastsViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
var viewModel: PodcastsViewModel!
var disposeBag = DisposeBag()
func viewDidLoad() {
super.viewDidLoad()
let cellIdentifier = String(describing: PodcastCell.self)
tableView.register(PodcastCell.self, forCellReuseIdentifier: cellIdentifier)
viewModel.podcasts
.bind(to: tableView.rx.items(cellIdentifier: cellIdentifier, cellType: PodcastCell.self)) { (row, country, cell) in
cell.populate(podcast: podcast)
}
.disposed(by: disposeBag)
viewModel.loadPodcasts()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment