Commit graph

46 commits

Author SHA1 Message Date
Ryan Nystrom
623ff2a8a8 Container size doesnt use content inset, add new APIs
Summary:
The content inset of a collection view can change at any time (as it does with our refresh control) and isn't a good measure of the container size. I don't want to totally remove that API though, so I changed the default behavior, added an insets API, and also added the functionality of the original in a new API.

This makes sizes much more deterministic.

Reviewed By: jessesquires

Differential Revision: D4800758

fbshipit-source-id: 85ce843b5b1c297cea2e2ea705fa255617cbe356
2017-03-30 09:35:03 -07:00
Ryan Nystrom
4e9b0bb4c4 Prevent negative spaces for items and supplementaries
Summary:
If a negative height/width comes down, cap it to `0.0`.

Issue fixed: #566

Also fixes t16455632 internally.

- [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/583

Differential Revision: D4797520

Pulled By: jessesquires

fbshipit-source-id: 3eeec5244a445bb451460286b4f006ca0d9c67d1
2017-03-29 15:01:08 -07:00
Ryan Nystrom
ca9e9a16b7 Fix unused variable warning when asserts compiled out
Summary:
Found this examining Travis output. Warning removed when asserts aren't compiled.

Closes https://github.com/Instagram/IGListKit/pull/580

Differential Revision: D4763179

Pulled By: rnystrom

fbshipit-source-id: af23780387e8d8f95f11fe778d91e281006ff6fb
2017-03-23 11:47:58 -07:00
Ryan Nystrom
a15ea08614 Move section controller mutation API to object provided in update block
Summary:
We constantly have random bugs pop up when mutations are made outside of a batch update. This change restricts the mutation API to a batch context object (which is just an `IGListAdapter`) so they can only be done **inside an update block**.

- Fixed open source project
- Confirmed open source examples build
- Updated all of Instagram.app to use this API
- Changelog breaking changes entry

Fixes #392

Reviewed By: jessesquires

Differential Revision: D4754129

fbshipit-source-id: 11d32a0fac3e50c9edbb01e92a8a0c7b8a43cf2d
2017-03-22 12:46:49 -07:00
Bofei Zhu
f7702fa713 Container Inset Size For Section Controller
Summary:
Add API for #315. Not sure if this is what you want rnystrom though 🤔. Will add tests after you confirm.

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [ ] 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/456

Reviewed By: jessesquires

Differential Revision: D4697190

Pulled By: rnystrom

fbshipit-source-id: f8513cf2fa33441eb40f486954136553d19dda0c
2017-03-15 09:25:40 -07:00
Leyla Hujer
68a264d29c Revert D4640425: [IGListKit] kill IGListCollectionView. GH issue #409
Summary: This reverts commit 871b75eaeb1c9f2a40fe8f3fd81b209661704587

Differential Revision: D4640425

fbshipit-source-id: 4b0e8a9820891062cf7f8d13de13d678adb5df4a
2017-03-06 16:15:31 -08:00
Jesse Squires
3fb2ac0d60 kill IGListCollectionView. GH issue #409
Summary: Remove `IGListCollectionView` per #409. Use plain old `UICollectionView`.

Reviewed By: rnystrom

Differential Revision: D4640425

fbshipit-source-id: 871b75eaeb1c9f2a40fe8f3fd81b209661704587
2017-03-06 15:01:01 -08:00
Alex Mathers
2a0b4c990a Add IGListCollectionContext API to get visible indexes.
Summary:
Add IGListCollectionContext API to get visible indexes:
`- (NSArray<NSIndexPath *> *)visiblePathsForSectionController:(IGListSectionController<IGListSectionType> *) sectionController`

Issue fixed: #465

- [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/507

Differential Revision: D4621418

Pulled By: jessesquires

fbshipit-source-id: 4b55500c83ca1b911c418e5857756bb076fc80e4
2017-02-28 14:32:06 -08:00
Ryan Nystrom
f639cdd287 Prevent stale adapter:collectionView corruptions
Summary:
This becomes an issue pretty easily in embedded `IGListAdapter` environments (lists in lists). IGListKit creates a single `IGListSectionController` instance per object, but cells are reused within `IGListCollectionView`. If you assign `adapter.collectionView = cell.collectionView` (like we recommend in our [example](https://github.com/Instagram/IGListKit/blob/master/Examples/Examples-iOS/IGListKitExamples/SectionControllers/HorizontalSectionController.swift#L40)), then you can have many adapters with a weak ref to the **same collection view**.

Obviously when updates happen across all embedded lists, adapters could potentially update the same collection view and apply a corrupted batch update.

I proposed using `<objc/runtime.h>` and using associated objects, but since `OBJC_ASSOCIATION_ASSIGN` is not zerod-on-release reference (its just `unsafe_unretained`) I'd have to make a weak wrapped object, which is overkill.

Instead I think a global weak:weak map is fine. We d
Closes https://github.com/Instagram/IGListKit/pull/517

Differential Revision: D4623300

Pulled By: rnystrom

fbshipit-source-id: 53d2dd158923c431e793b0c8e28997e9bbf55b8b
2017-02-28 07:32:10 -08:00
Ryan Nystrom
6bdcac81d8 Layout invalidation API
Summary:
Adding a new layout-invalidation API, telling the layout object to query and rebuild the layout for all items in the section controller. This works with `UICollectionViewFlowLayout` and should work with other custom layouts (including our own).

Issue fixed: #360, #459

- [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/499

Reviewed By: jessesquires

Differential Revision: D4590274

Pulled By: rnystrom

fbshipit-source-id: f87235be4e6c024bf979b831a8938be68895e011
2017-02-21 15:30:56 -08:00
Jesse Squires
7a94167be1 optimize. avoid unncessary copies.
Summary: Reduce and avoid unnecessary copies in IGListAdapter and IGListSectionMap.

Reviewed By: rnystrom

Differential Revision: D4555347

fbshipit-source-id: 3ade3311955fe5d12fc7617ad72feba9dafb60fb
2017-02-14 15:33:43 -08:00
Ryan Nystrom
9c37fbf8a4 Handle nil section controllers from data source
Summary:
Removing the assert and handling `nil` section controllers. This wont effect Swift code which demands a non-optional section controller, but Objective-C is more nuanced. There is evidence that some callers do not have a default state and are returning `nil`.

Unfortunately this will [OOB here](https://github.com/Instagram/IGListKit/blob/master/Source/Internal/IGListSectionMap.m#L63) if using the original `objects` array provided by the data source. Instead we prune the array, only allowing in objects that have a matching section controller.

Fixes t15773862 internally.

- [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/488

Reviewed By: dshahidehpour

Differential Revision: D4553886

Pulled By: rnystrom

fbshipit-source-id: a473a99b5eb513e4b610019dba0394a014193fc4
2017-02-14 08:01:47 -08:00
Ryan Nystrom
4eddd4a191 Consider supplementary views when sending display events
Summary:
This was a little bit of an invasive change with the display handler, but I think that this is the right call. When sending display events for objects, we should account for the supplementary view as part of the section controller. This is especially useful for headers and footers.

Note that this wont effect the working range API at all.

Fixes #300
Closes https://github.com/Instagram/IGListKit/pull/470

Differential Revision: D4551338

Pulled By: rnystrom

fbshipit-source-id: dda6fbf18bcfc2c941d80ee2314a543d1ab83843
2017-02-13 07:01:13 -08:00
Dustin Shahidehpour
fef72e579e Backed out changeset b72b444c1197
Summary: This diff isn't correct, and the Instagram cut happens today. Pulling back so I have time to test the correct change more throughly.

Reviewed By: rnystrom

Differential Revision: D4550149

fbshipit-source-id: 2e882caeb9ef999b7fd57562740b352ea8edfa5f
2017-02-12 14:30:39 -08:00
Ryan Nystrom
4dec244416 Add item-level moves to IGListCollectionContext
Summary:
Adding an API to do item-level (cell) moves on the collection view. This complicates things a little bit because of all the issues that moving sections have while in batch updates (e.g. simultaneous animation UICV bugs). Thankfully we use pretty strict types so the compiler does most of the work for us.

Closes #145

- [x] Tests build and pass
- [x] Add `IGListBatchUpdateData` tests to check moves during
  - [x] ~~Moving within a reloaded section (no op)~~ can't reload sections
  - [x] Moving within a deleted section (no op)
  - [x] Moving within a moved section (convert section ops to delete+insert)
  - [x] Moving an index path that is also reloaded (convert to delete+insert path)
- [x] Add move unit tests to `IGListAdapterUpdater`
- [x] Add move unit tests to `IGListReloadDataUpdater` (mostly for code coverage...)
- [x] Add move unit tests to `IGListStackedSectionController`
- [x] Add `CHANGELOG.md` entry for 3.0.0
- [x] Test moving without batch
Closes https://github.com/Instagram/IGListKit/pull/418

Reviewed By: jessesquires

Differential Revision: D4521732

Pulled By: rnystrom

fbshipit-source-id: 99a46d1cbb0cc1f857a62ff6ca257aff6e8b7f25
2017-02-10 18:01:18 -08:00
Adlai Holler
106054c181 Add -[IGListAdapter sectionControllerForSection:]
Summary:
Before the diff, you can lookup the object for a given section, and then lookup the section controller for that object, but this seems like a pretty valuable/common operation.
Closes https://github.com/Instagram/IGListKit/pull/477

Differential Revision: D4537479

Pulled By: rnystrom

fbshipit-source-id: ad47a243f0bb0fc72a362863dff2f00b0b640fab
2017-02-09 11:31:17 -08:00
Dustin Shahidehpour
fce3286ae4 Decouple Empty View from backgroundView, make it move with PTR
Summary:
1. The "Empty View" and CV background view are different things. People can now differentiate.
2. The Empty View isn't created until it is needed.
3. The Empty View moves with Refresh Controls.

![](https://media.giphy.com/media/26gslZ7qP07e4N9h6/giphy.gif)

- [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/462

Reviewed By: rnystrom

Differential Revision: D4502591

Pulled By: dshahidehpour

fbshipit-source-id: b72b444c1197c90c385c7414f0662299070a86d1
2017-02-06 08:14:00 -08:00
David Yamnitsky
5cc0fcd1d7 Fix calculation of vertical and horizontal center in scrollToObject
Summary: Fix bug where scroll position would be incorrect in call to `-[IGListAdapter scrollToObject:supplementaryKinds:scrollDirection:scrollPosition:animated:` with scrollDirection/scrollPosition of UICollectionViewScrollDirectionVertical/UICollectionViewScrollPositionCenteredVertically or UICollectionViewScrollDirectionHorizontal/UICollectionViewScrollPositionCenteredHorizontally and with a collection view with nonzero contentInset.

Reviewed By: jessesquires

Differential Revision: D4475043

fbshipit-source-id: 4714ab0ed02e52e2d7f333624cc17858058ee57f
2017-02-01 12:14:10 -08:00
Sherlock
528bd33136 Added -[IGListAdapter visibleCellsForObject:] API
Summary:
- Added `-[IGListAdapter visibleCellsForObject:]` API

1. Get all visible cells
2. Get the section for the object
3. Filter cells where indexPath.section of cell is equal to the object
4. Return

- [x] All tests pass. Demo project builds and runs.
- [x] I added test(s), an experiment, or detailed why my change isn't tested.
- [ ] 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)

-------------

Purely additive, can go in 2.2.0 release? Hold off on changelog until agreed.
Wanting to learn some more ObjC so gave this a shot, would appreciate some nit picking/feedback

Closes #437
Closes https://github.com/Instagram/IGListKit/pull/442

Differential Revision: D4450259

Pulled By: jessesquires

fbshipit-source-id: 521583c669fc1160212a7c46a50d62d951cafa2e
2017-01-23 11:28:57 -08:00
Bofei Zhu
2074eba50e Convert NSUInteger to NSInteger
Summary:
- [x] All tests pass. Demo project builds and runs.

No breaking changes that I am aware of.
Closes https://github.com/Instagram/IGListKit/pull/440

Differential Revision: D4448496

Pulled By: rnystrom

fbshipit-source-id: 9ad9bc3734b605ceab25bf6cdf993568aa6561c1
2017-01-22 14:44:14 -08:00
Bofei Zhu
d0ff14c934 Clean internal NSArray copying
Summary:
Fixed #384

- [x] All tests pass. Demo project builds and runs.
Closes https://github.com/Instagram/IGListKit/pull/441

Differential Revision: D4448500

Pulled By: rnystrom

fbshipit-source-id: 38276083a3689eea92c1c7afd1bded3c8fe96282
2017-01-22 14:44:14 -08:00
Peter Edmonston
dd3b9eddcc Fix for #378 - emptyView not updated when items added
Summary:
Modified `IGListAdapter` to update the `hidden` status of the `emptyView` after any item-level changes (`insertInSectionController:atIndexes:` and related methods) based on whether the item count is zero.

Closes #378

- [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/395

Differential Revision: D4400155

Pulled By: jessesquires

fbshipit-source-id: 6c3422297d86947e7e2878ba1b9227ff2a2a18b4
2017-01-10 14:43:57 -08:00
Weyert de Boer
fb4e823870 fix(385): Fixed a typo previuossectionMap -> previousSectionMap
Summary:
I have fixed the typo in the code `previuossectionMap` -> `previousSectionMap`. I don't think this change requires to be tested as it appears to be an internal class. Because of this it's not a breaking change so I don't think it needs to be reflected in CHANGELOG.md either.

Closes #385

- [X] All tests pass. Demo project builds and runs.
- [X] I added tests, an experiment, or detailed why my change isn't tested.
- [ ] 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/386

Differential Revision: D4390915

Pulled By: rnystrom

fbshipit-source-id: 1b745daaa913361ad211318ea1e216a03fe6f741
2017-01-09 10:14:01 -08:00
Bofei Zhu
1b55215e60 Fix assert for #388
Summary:
Fixed #388

- [x] All tests pass. Demo project builds and runs.
- [ ] 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/391

Differential Revision: D4389116

Pulled By: rnystrom

fbshipit-source-id: 632fd4b4e723387e220589a3be06d59981b8c43c
2017-01-09 10:14:01 -08:00
Adlai Holler
5fa588ee70 Make -[IGListAdapter updater] Public, Read-Only
Summary:
Hey IGListKit folks! Would you be willing to expose this, so that other objects that are given a list adapter can inspect its updater configuration?

- [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/379

Reviewed By: jessesquires

Differential Revision: D4379016

Pulled By: rnystrom

fbshipit-source-id: 4056457181fea31f71b1e928b60aec46160cc585
2017-01-03 16:59:02 -08:00
Ryan Nystrom
4cc91a25c8 Prevent data source deallocation during async updates
Summary: Saw some crashes come in from out-of-sync objects and section controllers. After some digging I found that the nil-datasource assert was firing (not very frequently). Mostly happening on other VCs, probably from hitting the back button and an update arriving.

Reviewed By: jessesquires

Differential Revision: D4347862

fbshipit-source-id: 38c1a4816f5c109de41297309745ac2d5e348e93
2016-12-19 13:43:56 -08:00
Ryan Nystrom
169c0d6c54 Prevent item reload, delete, insert collisions
Summary:
Adds a new test and fixes an item animation collision that `UICollectionView` throws on. Basically we cannot collide reloads with insert+delete.

The example in the test is trivial, but real-world situations do appear b/c of the coalescence of `IGListAdapterUpdater`. It can queue reloads and deletes/inserts at the same index paths while waiting.

- [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 have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/325

Differential Revision: D4322005

Pulled By: rnystrom

fbshipit-source-id: 2247163c13c0873a74ac485efff2d882ca6568f9
2016-12-13 13:44:02 -08:00
Jesse Squires
e5afb5b4d0 Add scrolling method on IGListCollectionContext. Close #267
Summary:
- Add scrolling method on IGListCollectionContext so that section controllers can scroll to themselves.
- Update CHANGELOG.
- Other misc fixes.
- Closes #267 on GitHub.

Reviewed By: rnystrom

Differential Revision: D4261144

fbshipit-source-id: 9eed833cfff06107607bba01a0beee1d871497b6
2016-12-01 16:14:04 -08:00
Ryan Nystrom
ca15e29cf1 Skip reloading objects that are not found
Summary:
Even with the assert, we will add `NSNotFound` to the set which will crash. Instead, skip adding the value in case a consumer is using a reference to an object that doesn't exist anymore.

Also, should be using `continue` if a section controller isn't returned by the data source.

Reviewed By: jessesquires

Differential Revision: D4226771

fbshipit-source-id: ed6df0992fdef611dd8fae64f4716e296df11f9a
2016-11-23 16:28:58 -08:00
Bofei Zhu
14e0727eff Specify end position for -scrollToObject
Summary: Closes https://github.com/Instagram/IGListKit/pull/196

Differential Revision: D4203333

Pulled By: rnystrom

fbshipit-source-id: 6ef0544c8e4f77afa25dd56df90c726d287c66a4
2016-11-18 10:58:58 -08:00
Ryan Nystrom
74affe0887 Fixes crash when accessing a cell within working range updates
Summary:
I was able to build a unit test that reproduces the issue. We can avoid the crash by simply returning `nil` when accessing a cell while working range events are being vended.

There is definitely something weird going on here though. When debugging `cellForItemAtIndexPath:` I found:

```
(lldb) po indexPath
<NSIndexPath: 0xc000000000000516> {length = 2, path = 5 - 0}
(lldb) po [[self collectionView] numberOfSections]
11
```

So in theory we should be fine, right? But when I continue I get

```
*** Assertion failure in -[UICollectionViewData numberOfItemsBeforeSection:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.5.2/UICollectionViewData.m:611
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'request for number of items before section 5 when there are only 3 sections in the collection view'
```

There _were_ 3 sections in the UICV before the update, but the data source and structure powering
Closes https://github.com/Instagram/IGListKit/pull/216

Differential Revision: D4204625

Pulled By: rnystrom

fbshipit-source-id: 455ed199dfc115077e4294e2843016a50e179015
2016-11-18 09:59:01 -08:00
Suraya Shivji
e2fbb68670 Swap NSUInteger to NSInteger Public API
Summary:
Swapped NSUInteger to NSInteger in public headers. Fixed a test in IGListSectionMapTests.m to pass with NSInteger. For issue #200!

- [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 have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/205

Differential Revision: D4191521

Pulled By: rnystrom

fbshipit-source-id: 3f15c5ee3f8ed2d382de2602912a2e998bfbcbba
2016-11-16 15:28:59 -08:00
Ayush Saraswat
1f40dfcab7 Add -[IGListAdapter objectForSectionController:] helper method -- iss…
Summary:
Add -[IGListAdapter objectForSectionController:] helper method

Fixes #201

- [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 have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/204

Differential Revision: D4189648

Pulled By: rnystrom

fbshipit-source-id: 75963dafef1a2905311e8edf6e98e99e5ab90061
2016-11-16 08:29:05 -08:00
Ryan Nystrom
386ae07864 Add visibleObjects API
Summary: Adding this API to make querying visible objects a little easier. Fixes #164.

Reviewed By: dshahidehpour

Differential Revision: D4138472

fbshipit-source-id: 0136c39e17c72941b85284b7f3b5494b1ddabf68
2016-11-07 07:29:06 -08:00
Ryan Nystrom
576ab4d1ff Remove NSIndexPath pretty print
Summary:
Saw this pop up in coverage reports. We don't log or assert `NSIndexPath` at all so this doesn't really seem necessary.

- [x] All tests pass. Demo project builds and runs.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/165

Differential Revision: D4138474

Pulled By: rnystrom

fbshipit-source-id: ad8375e47d1584f594d3df29f07a1d5d1a53f3c5
2016-11-06 12:44:10 -08:00
Ryan Nystrom
f5339113df Support supplementaryViews created from nibs (continued)
Summary:
Continuing the work on #90. I don't believe I can push directly to that PR since the origin is `master` of a repo I don't have access to.

https://help.github.com/articles/checking-out-pull-requests-locally/

I went ahead and added another supplementary view test copying the old one we had.

cc jessesquires in case there's something else I can do here. I believe this will still give rawlinxx credit?
Closes https://github.com/Instagram/IGListKit/pull/162

Differential Revision: D4137364

Pulled By: rnystrom

fbshipit-source-id: d8418ac5728fd6d9570fa1d1568f4343f5c4112b
2016-11-05 16:29:06 -07:00
Ryan Nystrom
cd6f8bce2a Remove reload data experiment
Summary: Another experiment with neutral results. Removing.

Reviewed By: jessesquires

Differential Revision: D4127194

fbshipit-source-id: cdafca161e0fec95cb35baad446929a03bb1cf4c
2016-11-03 16:29:32 -07:00
Bofei Zhu
158d04ebe0 Support supplementaryViews created from storyboard
Summary:
Miss this in the previous PR #92. Will add unit test soon.
Closes https://github.com/Instagram/IGListKit/pull/123

Differential Revision: D4101594

Pulled By: rnystrom

fbshipit-source-id: 820030358532b0878f6d9e9092834266c9260a38
2016-11-01 10:59:21 -07:00
Roman Klauke
348b11da4f reword some assertions with more informations
Summary:
This commit changes some assertion texts. No behavior is changed; no assertions are added (just reworded).  Some of them were short or contained no real meaningful informations, where the error probably is.

Ref: #113

- [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 have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/122

Differential Revision: D4090470

Pulled By: rnystrom

fbshipit-source-id: 96f492a1efd258ec3424ce334802229fdbdee191
2016-10-27 14:29:12 -07:00
Bofei Zhu
8855b5156a Add storyboard support #39
Summary:
This PR is for #39

- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/92

Differential Revision: D4066721

Pulled By: rnystrom

fbshipit-source-id: 4fca278ae9a54aa46626932d47d4a4c001b437d6
2016-10-25 15:29:13 -07:00
Bofei Zhu
a01e9954e3 Add asserts to IGListAdapter
Summary:
Fix #91
Closes https://github.com/Instagram/IGListKit/pull/108

Differential Revision: D4063183

Pulled By: rnystrom

fbshipit-source-id: 8ff4a5ac3bf7418cb968093e9f87b7fc55bc2fe1
2016-10-21 19:59:14 -07:00
Sven Bacia
ce4b851da3 Support cells created from nibs
Summary:
I started working on adding support for dequeuing cells created from nibs (issue #1). Additionally I extended `IGListSingleSectionController` so that it can be used with nibs too. I don't know if you had this also in mind.

- [x]  I'm currently thinking about the best way to test these changes.
- [x] I was not able to update the documentation (issue #55).

- [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 have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/56

Reviewed By: dshahidehpour

Differential Revision: D4023746

Pulled By: rnystrom

fbshipit-source-id: 6a8b4cfb4dba38ea6e9870a9a4506288ee155cfe
2016-10-14 18:59:18 -07:00
Ryan Nystrom
394760081c Add isLast/FirstSection API to IGListSectionController
Summary: Product needs show that section controllers need some sort of awarenes when they are the first/last section in a list (e.g. for cell borders). Adding this simple API, non-breaking.

Reviewed By: jessesquires

Differential Revision: D4016023

fbshipit-source-id: c75f9298fc73875a1cabad191fe2db6cb9ee4376
2016-10-13 12:44:12 -07:00
Ben Asher
992c3b7caa IGListAdapter: Fix not returning early when collectionView/dataSource is nil and completion is nil
Summary:
- I ran the static analyzer, and it found a case in `performUpdatesAnimated:completion:` where it looks like we meant to bail out early if the `collectionView` or `dataSource` is nil, but it only does so if `completion` is provided.
- Fixed a spelling error in nearby documentation

- [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 have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)

- There is one other analyzer warning, but it seems to be making an incorrect assumption. In any case, it's not something I can fix quickly (requires more time spent staring at IGListDiff.mm).
- A ticket should be opened to add static analysis to .travis.yml. I'lll do this soonish, unless someone beats me to it!

- I could add a test for this, but this project is annotated well enough with null
Closes https://github.com/Instagram/IGListKit/pull/51

Reviewed By: ocrickard

Differential Revision: D4008605

Pulled By: rnystrom

fbshipit-source-id: c2b7516cb8c1fc619aa63d1e9b0c26f2918cd8a1
2016-10-12 09:29:11 -07:00
Kyle Hickinson
a2e0005357 Replace reusable identifier methods with a C function (#40)
Summary:
Replaced the two methods for generating a reusable identifier with an inline C function (as per #40) which has 3 parameters: `viewClass` (unchanged), `nibName` (for when #1 is added), and `kind`. The string is generated following the same pattern as before.

A few things:
- The current test only tests one of the options. May want to add more tests for each.
- Not sure if you guys prefer `NS_INLINE` vs `static inline`.
- Not sure if we want to add assertions for empty strings for nibName/kind parameters.

- [x] All tests pass. Demo project builds and runs.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/49

Differential Revision: D4005549

Pulled By: jessesquires

fbshipit-source-id: e1683ebe8882d1a8de934c8166f67d3508cffba9
2016-10-11 17:59:08 -07:00
FBShipIt
cdc796746a Initial commit
fbshipit-source-id: c38b897b9e2b87c782e0e01b0145d9189dc7f9d8
2016-10-11 10:12:17 -04:00