Created
October 18, 2019 09:15
-
-
Save nalexn/c67c67d9ad026c283dc4db45b793bb20 to your computer and use it in GitHub Desktop.
Article_002 https://nalexn.github.io/mvvm-state-redundancy/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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