Commit graph

186 commits

Author SHA1 Message Date
Maxime Ollivier
82a2a2ee18 added experiment to make [IGListAdapter visibleSectionControllers] a bit faster
Summary:
* Issue: [IGListAdapter visibleSectionControllers] calls [UICollectionViewLayout layoutAttributesForElementsInRect:] which can be expensive. And since visibleSectionControllers is called in scrollViewDidScroll, it can add up and take a toll on scroll performance. On an iPhone 7, it's in 2-10% of the main-thread samples (using Time Profiler).
* Fix: IGListDisplayHandler conveniently keeps track of visible IGListSectionControllers, so let's just use that. Now, [IGListAdapter visibleSectionControllers] drops to ~0.3% of samples.

Reviewed By: rnystrom

Differential Revision: D6351474

fbshipit-source-id: 66914db95e08498927bfbceda4d2e9d58cbc7530
2017-11-16 16:07:29 -08:00
yemodin
319928f697 Make sure collection have unique ListDiffable objects on initial data…
Summary:
… source setup too

Issue fixed: #815

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

Reviewed By: jeremycohen

Differential Revision: D6264886

Pulled By: rnystrom

fbshipit-source-id: 5159b7989f1d17fd0a7522d986ed6abf012da77f
2017-11-15 11:27:25 -08:00
Saad Ismail
d6e26d54e8 IGListDiffKit
Reviewed By: rnystrom

Differential Revision: D6201376

fbshipit-source-id: c7d2e643de5329f00f6d7a2bec4f0fc86e81f27b
2017-11-06 17:02:06 -08:00
Rizwan Mohamed Ibrahim
b3ffafc018 Adds header docs to listener API in IGListAdapter #trivial
Summary:
Issue fixed: #997

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

Differential Revision: D6233518

Pulled By: rnystrom

fbshipit-source-id: ba944c29d094ac83554a97326bc5212ef1fd8671
2017-11-03 13:41:03 -07:00
Ryan Nystrom
8cffc50d7d Copy and nil block queue before executing #trivial
Summary:
Discovered in rnystrom/GitHawk#781 and introduced in d9a89c9b00. Can't repro in unit test, but have obvious stack traces (see GitHawk issue) that collection is being mutated while enumerated.

No changelog since this is a new fix for 3.2.
Closes https://github.com/Instagram/IGListKit/pull/995

Reviewed By: manicakes

Differential Revision: D6206957

Pulled By: rnystrom

fbshipit-source-id: c42e3688d0f2b31693199f8015b5de48b7b3b9e6
2017-11-03 11:29:41 -07:00
Ryan Nystrom
a6f264fc12 Update project settings and fix errors
Summary:
Updated the main project lib settings for iOS 11, fixed all errors (which are from warnings-as-errors).

- [x] All tests pass. Demo project builds and runs.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
Closes https://github.com/Instagram/IGListKit/pull/942

Differential Revision: D6161473

Pulled By: rnystrom

fbshipit-source-id: 1fd51d8805f9c6483942b44d750b2756efde9376
2017-10-26 11:20:55 -07:00
Ryan Nystrom
5cf01cc0a7 Add update finished announcer API
Summary:
Adding a new API to support adding 1:many listeners to observe when an `IGListAdapter` finishes performing an update event. It supports:

- `performUpdates:`
- `reloadData...`
- Even handling update triggered from //inside// a section controller

Differential Revision: D6108096

fbshipit-source-id: d0b43d83f1963fdbf6ef388685cbd8f6890177fa
2017-10-20 08:57:11 -07:00
Jakub Grzmiel
0f04a07319 Fix format warnings for clang 5.0
Summary: Fix format warning which occur when using clang 5.0 compiler.

Reviewed By: mzlee

Differential Revision: D5900751

fbshipit-source-id: 4e9aea068aab3d2d882b8fb103a8828e861da97c
2017-09-25 10:34:51 -07:00
Ryan Nystrom
b2860c3604 Fix scrollToObject: bug when scrolling to bottom with content inset
Summary:
This has been around forever, surprised we've never run into it. Instagram doesn't really use the `bottom` position except for one place that is already at the bottom of a view. Looks like this bug has just been hanging around quietly for ages.

`UIScrollView` takes into account the content inset when changing the content offset. Doing math w/ the inset is both useless and incorrect.

Issue fixed: #932

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

Differential Revision: D5881117

Pulled By: rnystrom

fbshipit-source-id: 5c9af4b6f8b59be977491ba734e9b0fa3c538cb9
2017-09-21 11:16:32 -07:00
Weyert de Boer
4f970d2317 Dedupe view models in IGListBindingSectionController
Summary:
Issue fixed: #700

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

Reviewed By: manicakes

Differential Revision: D5872117

Pulled By: rnystrom

fbshipit-source-id: 420190566c0a822834d8a3b64202f6d807e6a487
2017-09-20 18:04:11 -07:00
Ryan Nystrom
d9a89c9b00 Defer invalidatation until all batch updates are finished
Summary:
Added a mechanism to `IGListAdapter` to defer (_queue or execute_) blocks around asking the updater to do batch updates. I discovered a crash where the `_updateCompletionHandler` (private ivar) of `UICollectionView` was not being niled when two batch updates collide. There is an assert in `-[UICollectionView dealloc]` that fires if this block != nil. Took some reverse eng to track down what is happening.

Sadly I cannot reproduce the issue in a unit test _or_ sample app. However I can 100% repro this in my GitHawk app. Applying this patch fixes the problem. I added a unit test that got me _close_ to the state of the crash. Consider this new test future-proofing (also covers the enter/exit/defer stuff).

Also dumping the `UICollectionView` internals confirms that the bad state (`_updateCompletionHandler != nil`) is no longer true.

Issue fixed: #929

Depends on #930

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

Differential Revision: D5863761

Pulled By: rnystrom

fbshipit-source-id: 496aa939e3a5e83472b26bfb5a4cdc872f58cc0e
2017-09-20 09:49:48 -07:00
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
d322c2e5ae Weak reference collection view when queueing update
Summary:
Found a "bug" when adding some new unit tests. The queue method holds a strong ref to the collection view, and doesn't release it until that block is executed. The adapter may have already been released, holding onto the collection view is wasteful.

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

Differential Revision: D5861975

Pulled By: rnystrom

fbshipit-source-id: 986ead725839d39b30daadf92675b397f8794520
2017-09-19 09:03:42 -07:00
Ryan Nystrom
65a5e6de05 Fix binding SC deselection crash and publish 3.1.1
Summary:
- Fixed #918 by checking `respondsToSelector:` (boo optionals)
- Cut 3.1.1 for immediate publish

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

Differential Revision: D5748009

Pulled By: rnystrom

fbshipit-source-id: b387b3988abc785f312bc47ac003851283972d7a
2017-08-31 12:51:10 -07:00
Phil Larson
1717b2c904 IGListAdapter support for scrollViewDidEndDecelerating
Summary:
References #842

We use -[UIScrollViewDelegate scrollViewDidEndDecelerating:] delegate callback in the app we are building to hide/show elements when motion has ended.
Closes https://github.com/Instagram/IGListKit/pull/899

Differential Revision: D5689239

Pulled By: rnystrom

fbshipit-source-id: ea17fe94ccacc5e4f0a9e085e61f8f77cfcea3b4
2017-08-23 13:30:44 -07:00
Ryan Nystrom
d936d79b93 Bump versions to 3.1.0
Summary:
Bumping project, pod, and doc versions to 3.1.0
Closes https://github.com/Instagram/IGListKit/pull/908

Differential Revision: D5689815

Pulled By: rnystrom

fbshipit-source-id: 30345f12538f57efb467bf8159ec9645fe8aea96
2017-08-23 11:33:50 -07:00
Gulam Moledina
f79516ee66 Proper support vertical and bottom positions in IGListAdapter scrollToObject: API
Summary:
I simply wrote failing tests for `scrollToObject` API for the `ScrollPosition` parameter and then fixed the code.

If we agree that these tests are correct, I don't mind suggesting a fix for it. I think it's the `indexPath`'s row that is hardcoded to `0` that needs to be changed depending on the `scrollPosition` desired. (Done!)

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

Differential Revision: D5678607

Pulled By: rnystrom

fbshipit-source-id: ab902b58fe70667ef6133cb05569a2223a668243
2017-08-22 13:31:27 -07:00
Ryan Nystrom
5ca167806b Disable prefetching when setting the collection view
Summary:
Followup from #852 since `UIAppearance` doesn't have any effect. Automatically disable prefetching.

Issue fixed: #846

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

Reviewed By: jeremycohen

Differential Revision: D5651413

Pulled By: rnystrom

fbshipit-source-id: ed602aa4609038bd629c9366c383a23f32fc88df
2017-08-21 07:30:10 -07:00
Ryan Nystrom
ae3604c3fe Restore scrollToObject: API with layout fix
Summary:
Reverting the revert in D5651413. The origin PR:

https://github.com/Instagram/IGListKit/pull/808/files

Had a small bug in it that wasn't captured via unit tests b/c we use a custom layout. However this should also repro in `IGListCollectionViewLayout`, but none of our tests combine the two atm.

Differential Revision: D5651585

fbshipit-source-id: da6c67cba57ab1aad51535467bff86a21f16f2fa
2017-08-21 07:06:32 -07:00
Ryan Nystrom
79b8290a1e Back out D5353285 which crashes custom layout
Summary: Public PR crashes our custom layout b/c requesting # of items doesn't trigger `prepareLayout` on the layout. End up w/ OOB exceptions.

Differential Revision: D5622021

fbshipit-source-id: ecc8cc7bfb38e3ebe7f7433c96b816469f16774c
2017-08-14 10:05:07 -07:00
Gulam Moledina
e8ddaf8740 Fix CollectionView scroll behaviour when section is empty
Summary:
Issue fixed: When a section is empty (0 cells) but has a header/footer supplementary views, calling `scrollToObject:supplementaryKinds:scrollDirection:scrollPosition:animated` wouldn't do anything as the method implementation has an early return if the section doesn't have any cells:
![screen shot 2017-06-15 at 14 07 18](https://user-images.githubusercontent.com/978865/27195239-fd86401e-51d3-11e7-8630-a018fbba6858.png)

As the section does have supplementary views and is displayed on screen, there's no reason not to scroll to it. This minor change fixes this detail.

Change in internal implementation of one method - all current tests pass. No tests added.

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

Differential Revision: D5353285

Pulled By: rnystrom

fbshipit-source-id: 2b6700f98f7d38716d655dfecceb0353d65ef681
2017-08-11 15:45:00 -07:00
Candance Smith
1faf59b302 Added debug dump support to IGListBindingSectionController
Summary:
Issue fixed: #698

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

Differential Revision: D5611625

Pulled By: rnystrom

fbshipit-source-id: d9d54e2a10cf0cfae6cff121c20cc8d24d802716
2017-08-11 09:19:00 -07:00
Maxime Ollivier
6f946b2981 fixed IGListAdapterUpdater completion block animation transaction
Summary:
* Issue: UIView animation blocks created within IGListAdapterUpdater's completion block work sporadically. Example: Direct message animation:

https://pxl.cl/8sTk

* Cause: completion block called within CATransaction begin/commit
* Fix: commit CATransaction before calling completion block

Reviewed By: rnystrom

Differential Revision: D5592948

fbshipit-source-id: e7b20877b688a6a221a87b152ead830ccb34f12a
2017-08-10 06:17:44 -07:00
Peter Edmonston
9e312275c3 Add horizontal scrolling support to IGListCollectionViewLayout
Summary:
Issue fixed: #752

- [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)

This PR generalizes the layout logic in `IGListCollectionViewLayout.mm` to handle horizontally scrolling layouts, mainly by generalizing references to `width`, `height`, `x` and `y` to take scrolling direction into account. This changes the signature of `IGListCollectionViewLayout.init` as well as the names of a few properties, so it would be a breaking change.

I added a couple of unit tests specifically for horizontal layouts -- but held off from adding a horizontal version of *every* unit test for this class, as it would basically double the number of tests. But if you want that, just let me know and I'm happy to do it.

Also let me know if you want me to add a demo VC to the Examples project that uses this new horizontal flow layout -- I have some demo code handy (I used it for testing), but didn't want to clutter up the PR if you didn't want/need it.
Closes https://github.com/Instagram/IGListKit/pull/857

Reviewed By: ryanolsonk

Differential Revision: D5547266

Pulled By: rnystrom

fbshipit-source-id: 6094c45069fc265273d0f95c296fa78e47470384
2017-08-07 09:33:30 -07:00
Marvin Nazari
5bede7b78e Select an item through IGListCollectionContext
Summary:
We already had a API to deselect an item through `IGListCollectionContext` this is the support for selecting an item.

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

Reviewed By: ryanolsonk

Differential Revision: D5562902

Pulled By: rnystrom

fbshipit-source-id: 756a154607d7d758faddc70ac784e544739f5a93
2017-08-04 15:19:56 -07:00
Mani Ghasemlou
bb9b037ed3 Fix visible section controllers bug (#643)
Summary:
Issue fixed: #643

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

Reviewed By: manicakes

Differential Revision: D5553538

Pulled By: rnystrom

fbshipit-source-id: 25d98a28d47a15d494ba530c850e0335d87d758c
2017-08-03 13:06:14 -07:00
Levi McCallum
7d33065b88 Fix typo in collection context docs
Summary:
Issue fixed: #

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

Differential Revision: D5442884

Pulled By: rnystrom

fbshipit-source-id: d94832993279b2bae6f57e28fd2ef297bf00e291
2017-07-18 08:36:14 -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
61c1524bb0 Add experiment for reloadData on large changesets
Summary:
Preparing another perf test. I noticed in some surfaces that have **massive** updates (8k+ inserts/deletes) that perf can be pretty awful. This is all due to internals of `UICollectionView` trying to create cells and animate a huge blob of changes. Instead, I'm picking a sensible (is it?) default to just skip batch updates and do `reloadData` instead.

Unit tests caught that the `layoutIfNeeded` is required to immediately configure cells.

Depends on D5392713

Reviewed By: jeremycohen

Differential Revision: D5392882

fbshipit-source-id: e429ddb7bca7400908898ebc6f097a489211b03d
2017-07-12 12:54:28 -07:00
Ryan Nystrom
dfc6b687a8 Add changeCount API to index set and path results
Summary:
Adding this API as a standard in preparation for a reloadData fallback test, avoiding massive batch updates stalling the main thread.

Depends on D5392536

Reviewed By: jeremycohen

Differential Revision: D5392713

fbshipit-source-id: 9447bad4b76194ccf26d74c5111624b2fba02efa
2017-07-12 12:54:28 -07:00
Ryan Nystrom
3dc6060a38 Avoid rare crash when update queued during batch
Summary:
A new crash! I think this has been a pretty low-firing outlier for some time. Pretty excited to find this. Exposed when adding bg updating as things were likely to collide more frequently, instead of being blocked by main.

Unit test fails w/out the patch applied to the updater.

Depends on D5392269

Reviewed By: jeremycohen

Differential Revision: D5392301

fbshipit-source-id: 5b24d1b41e2a0bdba2b6bc2bfa4f6eeeb36fc4f1
2017-07-12 12:54:28 -07:00
Ryan Nystrom
1d773aa533 RFC: Diff in the background
Summary:
Experimenting with a new change. We have observed instances of very large (3k+) lists stalling, even on modern devices. This is especially noticeable if the models being diffed are:

- Immutable
- `performUpdates:` often and models are alloc/init'd each time
- The `isEqualToDiffableObject:` is sort of expensive (many `-[NSString isEqualToString:]` across thousands of models or something)

Instead of just rolling this out, I plan on experimenting with results and seeing how much of a performance and stability boost we gain w/ this. Things to measure:

- Scroll performance
- CPU stalls
- WatchDog kills on older devices
Closes https://github.com/Instagram/IGListKit/pull/841

Reviewed By: amonshiz

Differential Revision: D5364127

Pulled By: rnystrom

fbshipit-source-id: 31d50d2e4b3c7c73584d6ec521a9047efd83f315
2017-07-06 09:46:30 -07:00
Weyert de Boer
9f5bf3fb7e Improved the documentation
Summary:
Improved the documentation so it that the Getting Started guide calls out that you need to set `dataSource`-property of the `IGListAdapter` as I totally misse that.
Closes https://github.com/Instagram/IGListKit/pull/820

Differential Revision: D5353295

Pulled By: rnystrom

fbshipit-source-id: deca1d75fad08f69081033ae1a65302a4f10ba9f
2017-06-29 18:32:31 -07:00
Chen (Bert) Li
1d926d9a97 Fix over-scrolling issue in IGListAdapter scrollToObject: method
Summary:
UIScrollView can over-scroll, if content offset is too small or too large.

Providing methods to help calculate safe content offsets, given the desired values. Use the safe content offsets in IGListAdapter.

Reviewed By: rnystrom

Differential Revision: D5312473

fbshipit-source-id: d882948940ce08c48f5ff0ab8d997591f62915a8
2017-06-29 09:09:00 -07:00
Andrew Monshizadeh
e58a44cfbe Compare using FLT_EPSILON
Summary:
Floating point math loses precision and so comparing two floats that are likely to only differ in the mantissa, and even then by extremely small amounts, is tricky. Exact equality often fails in these cases and asserting on exact equality is probably not necessary.
Closes https://github.com/Instagram/IGListKit/pull/828

Differential Revision: D5310575

Pulled By: rnystrom

fbshipit-source-id: f942489fbe0b2bc5f215329caac8abbae577a830
2017-06-26 18:03:51 -07:00
Ryan Nystrom
d0253b705a Don't assert indexForCell: API when cell isn't visible
Summary:
Noticed this randomly debugging. Say you have a completion block that finishes after some async task happens. If you scroll the cell off screen it will return `nil` for `-[UICollectionView indexPathForCell:]`, and the assert will fail (unless the SC is at 0). Quiet some asserts.
Closes https://github.com/Instagram/IGListKit/pull/824

Differential Revision: D5303432

Pulled By: rnystrom

fbshipit-source-id: 64432c43f46d33ce052e6f4fedc094c1fc1f04e1
2017-06-22 13:03:30 -07:00
Viktor Gardart
95367bb6a4 replace alloc] init] -> new]
Summary:
Issue fixed: #822

As rnystrom would've said: Go 💚
Closes https://github.com/Instagram/IGListKit/pull/823

Differential Revision: D5301864

Pulled By: rnystrom

fbshipit-source-id: c7a0f62b91712a54ee75ee0d1fe62b8611745e37
2017-06-22 09:31:45 -07:00
Viktor Gardart
8073736772 Add assertion and tests for non unique diffIdentifiers
Summary:
Issue fixed: #814

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

Differential Revision: D5301480

Pulled By: rnystrom

fbshipit-source-id: 3a1989aae8de5d03aa803d51b88c65eed999c4bb
2017-06-22 07:53:56 -07:00
Weyert de Boer
68b73133fc Feature/beginners warning
Summary:
Issue fixed: #811

I don't think this change needs a item in `CHANGELOG.md` as it's not a real bug fix or enhancement that influences the behaviour of the library.

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

Differential Revision: D5283118

Pulled By: rnystrom

fbshipit-source-id: 518d38c7f620cef3e85cae5fd4a1c48567bcc48c
2017-06-20 08:32:58 -07:00
Joseph Ortiz
81955e4106 Remove white space
Summary:
Issue fixed: #770

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

Differential Revision: D5137558

Pulled By: rnystrom

fbshipit-source-id: e8c94d5d6d0ffde4f283915a21cd015604938c88
2017-05-27 08:17:59 -07:00
Rusty Bailey
98218cab58 Fix typo: experiements > experiments.
Summary:
Issue fixed: #773

- [ ] All tests pass. Demo project builds and runs.
- [ ] 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.
- [ ] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/776

Differential Revision: D5129343

Pulled By: rnystrom

fbshipit-source-id: 127126545f246e5431636642f203c8150b6a547b
2017-05-25 08:22:37 -07:00
James Sherlock
fb5dd116a2 Spelling & General Fixes
Summary:
Closes #771, #768, #767, #766, #765
Closes https://github.com/Instagram/IGListKit/pull/789

Differential Revision: D5129348

Pulled By: rnystrom

fbshipit-source-id: 4f3da39e643adade99fa7549098ff39d6350de17
2017-05-25 08:03:37 -07:00
heshamsalman
4770164599 unintercepted => non-intercepted, close #774
Summary:
Issue fixed: #774

- [ ] All tests pass. Demo project builds and runs.
- [ ] 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.
- [ ] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/787

Differential Revision: D5129345

Pulled By: rnystrom

fbshipit-source-id: 2673191f566a189a1374bfcff8a6639e1cb1fa29
2017-05-25 08:03:36 -07:00
Roshan Nindrai
f4cee8060d Fixed typos around 'dequeing'
Summary:
This reverts commit cc03917950.

Issue fixed: #772

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

Differential Revision: D5129335

Pulled By: rnystrom

fbshipit-source-id: 87efbd13b4ba7132f50d6a4de0430190172fd30c
2017-05-25 08:03:36 -07:00
Ryan Nystrom
0a416914d5 Rename sectionIndex API to just section
Summary:
Quick rename before releasing 3.0 to get this API in parity w/ `isFirstSection` and `isLastSection`. My b I should have caught this in review.

Closes #720

Reviewed By: jessesquires, amonshiz

Differential Revision: D5031184

fbshipit-source-id: 1cd7b00c8b32084fecd861e78808eea0d0056337
2017-05-11 14:49:59 -07:00
Ryan Nystrom
7304fe820d Fix UICollectionView debug dump script
Summary:
Duh, need to import macro

Issue fixed: #722

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

Differential Revision: D5040026

Pulled By: jessesquires

fbshipit-source-id: e9e51137ab4f7fa949667e3f3d644cd5c03abf80
2017-05-11 14:31:28 -07:00
Ryan Nystrom
d1cd23b3d0 Bump pod and project version to 3.0.0
Summary:
Part of #707
Closes https://github.com/Instagram/IGListKit/pull/731

Reviewed By: rnystrom

Differential Revision: D5036877

Pulled By: jessesquires

fbshipit-source-id: f63ce3369019870df87ebde59d6f6b0e95c8ad87
2017-05-10 12:32:05 -07:00
Andrew Monshizadeh
1d140e441a Reset all section controllers when a list adapter is deallocated
Summary:
This change will ensure that section controllers have the following properties reset to sensible default values when their owning list adapter is deallocated.

```
isFirstSection = NO
isLastSection = NO
sectionIndex = NSNotFound
```

Issue fixed: #709

- [X] All tests pass. Demo project builds and runs.
- [X] I added tests, an experiment, or detailed why my change isn't tested. (Existing test is updated to ensure this doesn't regress)
- [ ] 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/723

Reviewed By: rnystrom

Differential Revision: D5032445

Pulled By: jessesquires

fbshipit-source-id: 446a30f4206ce02d3ad89fcd9b4586587f396f58
2017-05-10 10:02:55 -07:00
Bas Broek
f94d01ed17 Add isPrefetchingEnabled to debug description
Summary:
Issue fixed: #725

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

Differential Revision: D5032405

Pulled By: jessesquires

fbshipit-source-id: aeda891f09c6aec751daa672258c0b071ea75ae2
2017-05-09 16:20:47 -07:00
Robert Payne
40625f8ff9 Swift name annotations
Summary:
This adds `NS_SWIFT_NAME` annotations to all public API's to provide cleaner integration into Swift:

- Removes the need to prefix classes in Swift code, instead rely on Swift module name spacing
- Adds more argument labels to C function API's like `IGListDiff([], [], .equality)` => `ListDiff(oldArray: [], newArray: [], option: .equality)`

While this is a large API change it should be as easy as:

- Find and replace `(IGList)([^K])` to `List$2` in Xcode with a scope set to Swift
- Build and follow compiler's auto fix corrections for C API's or any missed renames

I have not updated the documentation to reflect this yet, I am totally willing to do so but before I sink that amount of time into it I wanted to see if the Instagram team is even open to this change!

- [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)
- [ ] I have updated the documentation
Closes https://github.com/Instagram/IGListKit/pull/593

Reviewed By: jessesquires

Differential Revision: D5028039

Pulled By: rnystrom

fbshipit-source-id: b473d874a1f9574e56b2ebaabd5b73d1b57d4bab
2017-05-09 14:31:28 -07:00