This file contains hidden or 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
| let dataSource = RxTableViewSectionedReloadDataSource<CustomSection>( | |
| configureCell: { [weak self] _, tableView, indexPath, viewModel in | |
| guard let cell = tableView.dequeueReusableCell(withIdentifier: CustomTableViewCell.reuseIdentifer, for: indexPath) as? CustomTableViewCell else { return UITableViewCell() } | |
| cell.viewModel = viewModel | |
| cell.disposeBag = self?.disposeBag // Bad idea, don't do this! | |
| return cell | |
| }) |
This file contains hidden or 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 MyCell: UITableViewCell { | |
| private var disposeBag = DisposeBag() | |
| override func prepareForReuse() { | |
| super.prepareForReuse() | |
| disposeBag = DisposeBag() // Destroys and disposes of old subscriptions, creates a new cell | |
| } | |
| } |
This file contains hidden or 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
| _ = Observable<Int>.interval(.seconds(1), scheduler: MainScheduler.instance) | |
| .subscribe(onNext: { _ in | |
| print("Rx Resource Count: \(RxSwift.Resources.total)") | |
| }) |
OlderNewer