Summary:
adopt adjustedContentInset instead of contentInset on iOS 11
- [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/1020
Reviewed By: manicakes
Differential Revision: D6513703
Pulled By: rnystrom
fbshipit-source-id: 5d718f2cb30361959ca5ba8238746427223cb5fd
Summary:
Update pod and examples so project builds when synced
Depends on D6545334
Reviewed By: rnystrom
Differential Revision: D6573821
fbshipit-source-id: b0d4246fa9c0d627ebcd34ac7abd5c8453964037
Summary: * IGListCollectionViewLayout can now keep track of the minimumInvalidatedSection given individual section updates.
Reviewed By: rnystrom
Differential Revision: D6545333
fbshipit-source-id: 64c9b5ff32339299b52059a4d990a42d9e6a1af5
Summary:
* Currently, we invalidate the entire layout whenever we make any updates, like inserting new rows at the bottom.
* This is one of the most common causes of frame drop on feed, so let's allow partial invalidation based on the minimum modified section.
* For example, if we delete section 10, move section 4, and insert section 12, we would re-calculate the layout starting at section 4.
* This gets us the majority of the performance gains and it's relatively simple. In the future, we can make further optimizations, like 1) index path level invalidation and 2) finding the smallest modified index path whose properties (ex: size) have actually changed.
Reviewed By: rnystrom
Differential Revision: D6510140
fbshipit-source-id: 6ff1766b400c5aa82abc29ae76ab96660c3bb106
Summary:
Followup to make sure that object type mismatches can't happen, even if identifiers collide (which is discouraged). Add assert when duplicates are detected.
Patched some unit tests while I'm in here.
Reviewed By: calimarkus
Differential Revision: D6439094
fbshipit-source-id: d669c01734e5ce9483e851051f548d9960b3087c
Summary:
It's hard to figure out what the problem is, if you don't know which viewModel causes the trouble at all.
Let's add the class name to the assertion message.
Differential Revision: D6419460
fbshipit-source-id: 58edebca7839871b6d48e463caad957d7920e129
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: manicakes
Differential Revision: D6388270
Pulled By: rnystrom
fbshipit-source-id: e5e7e047bad5f21b81b562ebd586f7f5036325ff
Summary:
**Changes occurred only for the IGListCollectionViewLayout.**
**Specifically:**
1. Harnessed the hardcore to the fact that it is possible to use only headers.
2. Assertions removed
3. Caching for layout of attributes of footers
4. Implemented the location of the footers in any orientation scroll
Issue fixed: #898
I need this enhancement ASAP 🙏
**Example:**
Footers with user comments count

- [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)
- [x] I updated example project with implemented feature
Closes https://github.com/Instagram/IGListKit/pull/1017
Reviewed By: jeremycohen
Differential Revision: D6385893
Pulled By: rnystrom
fbshipit-source-id: 5f1bad5655d2df321f8c71496aa797ac8e3d226a
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
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
Summary:
tvOS Tests were failing because `IGListAdapterUpdateTester` was being used by `IGListAdapterE2ETests` but `IGListAdapterUpdateTester` was not included in the tvOS Target.
Error Msg:
```
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_IGListAdapterUpdateTester", referenced from:
objc-class-ref in IGListAdapterE2ETests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
Reviewed By: rnystrom
Differential Revision: D6251880
fbshipit-source-id: 463452c2206bac79e9c5738306b61c693ea580ca
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
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
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
Summary:
Issue fixed: #963
- [ ] 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/970
Differential Revision: D6161614
Pulled By: rnystrom
fbshipit-source-id: 7fcb71a57453ac0be55909030d6934a1701a49ba
Summary:
Update Getting Started file to display that 'IGListDiffable' has been renamed to 'ListDiffable' (as seen on Xcode)
Issue fixed: N/A
- [ ] 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/964
Differential Revision: D6161503
Pulled By: rnystrom
fbshipit-source-id: a3602393bb29a31d05fd9590aaa44f03bd5827d7
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
Summary:
Fixes examples failing to build after #916. I should have looked at Travis closer, my bad!
- [x] All tests pass. Demo project builds and runs.
Closes https://github.com/Instagram/IGListKit/pull/946
Differential Revision: D6008573
Pulled By: rnystrom
fbshipit-source-id: 727da8f8e8d1079c7840aa9db1152477bf1058ee
Summary: Fix format warning which occur when using clang 5.0 compiler.
Reviewed By: mzlee
Differential Revision: D5900751
fbshipit-source-id: 4e9aea068aab3d2d882b8fb103a8828e861da97c
Summary:
Used migration tool with Swift 4, fixed build errors, and killed all warnings. Only non-trivial change was in the macOS example. Will flag that one.
No changelog needed for this, right?
- [x] All tests pass. Demo project builds and runs.
Closes https://github.com/Instagram/IGListKit/pull/941
Differential Revision: D5890505
Pulled By: rnystrom
fbshipit-source-id: 7e0d3510ff0e5856a0ffd59f1a97548a72266c20
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
Summary:
Issue fixed: #
- [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/945
Differential Revision: D5881110
Pulled By: rnystrom
fbshipit-source-id: 7f20fcaac04f64576a52ca68af87d3db64f199b9
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
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
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
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
Summary:
The search bar used to set the text as empty when the user scrolls.
Closes https://github.com/Instagram/IGListKit/pull/922
Differential Revision: D5768667
Pulled By: rnystrom
fbshipit-source-id: 8a77708c2bd4101fbdef1401a1ad0d8d6e2fae7d
Summary:
Issue fixed: #381
- [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/915
Differential Revision: D5758006
Pulled By: rnystrom
fbshipit-source-id: cbc3f19b6bb9604d8a6c8c15a16414e558e3b70c
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
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
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
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
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
Summary:
References #894
Disabled force unwrapping, but force try and force cast rules are still in effect:
```swift
let k = object.things! // no longer causes a warning
let r = object.fidget as! Spinnable // causes warning
let s = try! object.doDangerousTask() // causes warning
```
Closes https://github.com/Instagram/IGListKit/pull/897
Differential Revision: D5651127
Pulled By: rnystrom
fbshipit-source-id: 7174cc52d24de3c2cdc15a29c7b053b12d68b1e3
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
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:

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
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
Summary:
This adds the new default header option added in Xcode 9 B3. This works except for `//` being appended at the beginning which is referenced as a radar in the link (rdar://33451838). I used this as the default header. Let me know if you would like something else.
```/**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
```
Issue fixed: #875
- [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/882
Differential Revision: D5611619
Pulled By: rnystrom
fbshipit-source-id: afcb11589351567eee9fea72d448cb1689153e29