Skip to content

Commit cf5f661

Browse files
freak4pckzaher
authored andcommitted
Clarify documentation on Animated Data Sources, IdentifiableType and Equatable
1 parent 267ebae commit cf5f661

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,16 @@ Observable.just(sections)
119119
.disposed(by: disposeBag)
120120
```
121121

122+
### Animated Data Sources
122123

123-
### Animations
124-
To implement animations with RxDataSources, the same steps are required as with non-animated data, execept:
125-
- SectionOfCustomData needs to conform to `AnimatableSectionModelType`
126-
- dataSource needs to be an instance of `RxTableViewSectionedAnimatedDataSource` or `RxCollectionViewSectionedAnimatedDataSource`
124+
RxDataSources provides two special data source types that automatically take care of animating changes in the bound data source: `RxTableViewSectionedAnimatedDataSource` and `RxCollectionViewSectionedAnimatedDataSource`.
125+
126+
To use one of the two animated data sources, you must take a few extra steps on top of those outlined above:
127127

128+
- SectionOfCustomData needs to conform to `AnimatableSectionModelType`
129+
- Your data model must conform to
130+
* `IdentifiableType`: The `identity` provided by the `IdentifiableType` protocol must be an **immutable identifier representing an instance of the model**. For example, in case of a `Car` model, you might want to use the car's `plateNumber` as its identity.
131+
* `Equatable`: Conforming to `Equatable` helps `RxDataSources` determine which cells have changed so it can animate only these specific cells. Meaning, changing **any** of the `Car` model's properties will trigger an animated reload of that cell.
128132

129133
## Requirements
130134

0 commit comments

Comments
 (0)