Skip to content

Commit 5d4eb85

Browse files
committed
Changes dispose code.
1 parent c7b62d6 commit 5d4eb85

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ let data = Observable<[String]>.just(["first element", "second element", "third
3939
data.bindTo(tableView.rx.items(cellIdentifier: "Cell")) { index, model, cell in
4040
cell.textLabel?.text = model
4141
}
42-
.addDisposableTo(disposeBag)
42+
.disposed(by: disposeBag)
4343
```
4444

4545
This works well with simple data sets but does not handle cases where you need to bind complex data sets with multiples sections, or when you need to perform animations when adding/modifying/deleting items.
@@ -52,7 +52,7 @@ With RxDataSources, it is super easy to just write
5252
let dataSource = RxTableViewSectionedReloadDataSource<SectionModel<String, Int>>()
5353
Observable.just([SectionModel(model: "title", items: [1, 2, 3])])
5454
.bindTo(tableView.rx.items(dataSource: dataSource))
55-
.addDisposableTo(disposeBag)
55+
.disposed(by: disposeBag)
5656
```
5757
![RxDataSources example app](https://raw.githubusercontent.com/kzaher/rxswiftcontent/rxdatasources/RxDataSources.gif)
5858

@@ -116,7 +116,7 @@ let sections = [
116116

117117
Observable.just(sections)
118118
.bindTo(tableView.rx.items(dataSource: dataSource))
119-
.addDisposableTo(disposeBag)
119+
.disposed(by: disposeBag)
120120
```
121121

122122

0 commit comments

Comments
 (0)