You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+92-4Lines changed: 92 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,21 +21,109 @@ Table and Collection view data sources
21
21
-[x] Works with `UITableView` and `UICollectionView`
22
22
23
23
## Why
24
-
25
24
Writing table and collection view data sources is tedious. There is a large number of delegate methods that need to be implemented for the simplest case possible.
26
25
27
-
The problem is even bigger when table view or collection view needs to display animated updates.
26
+
RxSwift helps alleviate some of the burden with a simple data binding mechanism:
27
+
1) Turn your data into an Observable stream
28
+
2) Bind the data to the tableView/collectionView using one of:
let dataSource = Observable<[String]>.just(["first element", "second element", "third element"])
36
+
37
+
dataSource.bindTo(tableView.rx_itemsWithCellIdentifier("Cell")) { index, model, cell in
38
+
cell.textLabel?.text= model
39
+
}
40
+
.addDisposableTo(disposeBag)
41
+
```
42
+
43
+
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.
44
+
45
+
These are precisely the use cases that RxDataSources helps solve.
28
46
29
-
This project makes it super easy to just write
47
+
With RxDataSources, it is super easy to just write
0 commit comments