Commit graph

3 commits

Author SHA1 Message Date
Kevin Delannoy
9ddc64f4ce Add cell (un)highlight APIs
Summary:
This implements the `collectionView:didHighlightItemAtIndexPath:` and `collectionView:didUnhighlightItemAtIndexPath:` `UICollectionViewDelegate` APIs and forward the calls to the appropriate `IGListSectionController`.
For the most part, it's doing the same thing as the `collectionView:didDeselectItemAtIndexPath:` calls and tests are also based on that feature.

- Implements `collectionView:didHighlightItemAtIndexPath:` and `collectionView:didUnhighlightItemAtIndexPath:` in IGListAdapter
- Catch those selectors in `IGListAdapterProxy`
- Adds `didHighlightItemAtIndex:` and `didUnhighlightItemAtIndex:` methods to IGListSectionController and friends (supports `IGListBindingSectionController` via its delegate and `IGListStackedSectionController`)
- Tests for changes

Issue fixed: I didn't open one, so none I guess.

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/933

Differential Revision: D5872090

Pulled By: rnystrom

fbshipit-source-id: adc93b68aced3e995f32c291bf607a263cd58edf
2017-09-20 08:46:17 -07:00
Ryan Nystrom
6540f960e2 Add cell deselection API
Summary:
Adding support for a cell deselection API. Trying to make some headway to move and drag+drop support, but also want better stock `UICollectionView` API support. Will also assist eventual `UITableView` support.

- Added overridable API to `IGListSectionController`
- Support for stacked SC
- Breaking, required protocol for binding SC

Assists #524 and #184

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
Closes https://github.com/Instagram/IGListKit/pull/853

Reviewed By: jeremycohen

Differential Revision: D5425414

Pulled By: rnystrom

fbshipit-source-id: 0b25c125b1f171979a15c3095095fc18b4108be6
2017-07-17 14:19:41 -07:00
Ryan Nystrom
79348164a7 Auto diffing section controller
Summary:
Started work on the plane to get this moving since #418  is up and ready to land. We'll likely need to spend some time fleshing out the API of this, and I think I'll split it up into a couple different PRs once ready for review. Putting this up now to get early feedback.

This adds an auto-diffing section controller as outlined in #38. There are several key parts:

- Subclass a new section controller `IGListAutoSectionController` (naming wip)
- Connect a data source
- Implement the data source methods that do 3 things:
  - Given a top-level object, transform it into an array of **diffable** view models
  - Given a view model, return a cell
  - Given a view model, return a size for a cell
- A new protocol for the cell `IGListBindable` so that we can control when the cell is updated w/ the view model.
  - The most important part of this is that it unlocks moving and reloading a cell, which you can't do w/ `UICollectionView`

- [ ] Unit test `reloadObjects:`
- [x] Add
Closes https://github.com/Instagram/IGListKit/pull/494

Reviewed By: amonshiz

Differential Revision: D4696966

Pulled By: rnystrom

fbshipit-source-id: f21b8341b3ed4389f2a4a106d0d316f481ba6943
2017-03-15 07:47:24 -07:00