Skip to content

Commit

Permalink
Add DTModelStorage additions to migration guide, fix typos.
Browse files Browse the repository at this point in the history
  • Loading branch information
DenTelezhkin committed Sep 2, 2020
1 parent 223ef7f commit e814db4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions Documentation/Migration guides/8.0 Migration Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,26 @@ This registration works for xib-less cell registration as well as registering `P

> New syntax is backwards-compatible with old syntax without closures: `manager.register(PostCell.self)` - `mapping` and `handler` closures are optional.
### DTModelStorage additions

`ViewModelMapping` class has been reworked from the ground up to allow holding generic information about reusable views and cells, as well as dequeuing configured views.

`MemoryStorage` now has `insertItems(_:at:)` method, that allows inserting collection starting from provided indexPath. This is useful for example if you show a list of items and a load more button/spinner, and want to insert new page of items between old items and paging cell:

```swift
try? manager.memoryStorage.insertItems(newPosts, at: IndexPath(item: self.numberOfItems - 1, section: 0))
```

`ViewModelMapping` now has a new convenience method `modelCondition` for conditional mappings:

```swift
manager.register(OddCell.self) { mapping in
mapping.condition = mapping.modelCondition { indexPath, model in
return indexPath.item.isOdd
}
}
```

### In-depth documentation

Along with [API reference](https://dentelezhkin.github.io/DTTableViewManager/), there is now [extensive documentation](..), broken into sections for your convenience. It covers board range of topics, including datasources, events, mapping/registration and more.
Expand Down Expand Up @@ -183,3 +203,4 @@ manager.register(PostCell.self) { mapping in

* `DTTableViewManager.configureEvents(for:_:)` is deprecated, it's functionality has become unnecessary since mapping closure of cell/header/footer registration now captures both cell and model type information for such events.
* `DTTableViewManager.configureDiffableDataSource(modelProvider:)` is deprecated for non-hashable data models. Please use configureDiffableDataSource method for models, that are Hashable. From Apple's documentation: `If you’re working in a Swift codebase, always use UITableViewDiffableDataSource instead`.
* `TableViewUpdater.usesLegacyTableViewUpdateMethods` property.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Of course, cool stuff does not stop there, framework supports all datasource and

* [Can I implement delegate methods instead of using DTTableViewManager event closures?](Documentation/Events.md#can-i-still-use-delegate-methods)
* [How can I react to and customize UITableView updates?](Documentation/TableViewUpdater.md)
* [What can be additionally configured when using DTTableViewManager with UITableView?][Documentation/TableViewConfiguration]
* [What can be additionally configured when using DTTableViewManager with UITableView?](Documentation/TableViewConfiguration)
* [What if something goes wrong?](Documentation/Anomalies.md)

## Sample code and documentation
Expand Down

0 comments on commit e814db4

Please sign in to comment.