Summary: Updates the iOS, macOS and tvOS example apps Xcode projects to be based off Xcode 15 with all appropriate new build configurations.
Reviewed By: fethica
Differential Revision: D50294914
fbshipit-source-id: b6b292ec53e4ab9f336c23e81af3fc6815881398
Summary: Updates the main IGListKit Xcode project to be based off the Xcode 15 format, and updates to all of the new recommended build configurations
Reviewed By: fethica
Differential Revision: D50294911
fbshipit-source-id: 2326cca2458eb9997cbb865b91df8741fdee5eaf
Summary:
The tests on GitHub Actions were still failing, so while I was trying to find the cause, I decided to take this opportunity to update the entire build harness to work off Xcode 15.
This diff updates all of the Bundler dependencies up to their latest versions.
Reviewed By: fethica
Differential Revision: D50294912
fbshipit-source-id: 93f09f901d58c92606bbe8d3c370661828f2a1f4
Summary:
The issue I've been seeing is that list kit would not recalculate layout for when collection view bounds would change
IGListCollectionViewLayout has code to invalidate layout when collection view size chances however it would not happen without explicitly calling `….collectionViewLayout invalidateLayout];`
It appears that in the loop of calculating the layout we would accidentally call the code that would start caching existing layout data (not calculated at the point of call) and cache the value
This does not seem to happen all the time, however moving the cache purge to the end of layout calculation loop seems reasonable since at this point we have the new values that can't be known to the cache
As long as the consumer uses `IGListCollectionViewLayout` explicitly or implicitly through convenience initialize of `IGListCollectionView` this fix should work as is
Reviewed By: fabiomassimo
Differential Revision: D50197736
fbshipit-source-id: cb6d818f8be965f2e6ba494ffea083a6ab35682d
Summary:
## Changes in this pull request
class_replaceMethod is significantly faster as it doesn't need to clear the entire method cache, which can be quite expensive for large apps.
NFC, but it should be faster. No new test failures.
Issue fixed: #
### Checklist
- [ ] 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/main/.github/CONTRIBUTING.md)
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1583
Reviewed By: fabiomassimo
Differential Revision: D50013222
Pulled By: TimOliver
fbshipit-source-id: 157fea52f3768b16acd09b149bd16bea4e5fdc27
Summary:
The `[context invalidateDataSourceCounts] && _minimumInvalidatedSection == NSNotFound` condition was never getting triggered in any of our tests.
I tried to simulate this condition in my testing, but it doesn't seem possible to have `_minimumInvalidatedSection` set to `NSNotFound` when execution reaches this point. This is because the only public pathway I could see to `[context invalidateLayoutWithContext:]` was via the regular `invalidateLayout` method which always sets `_minimumInvalidatedSection` to 0 before continuing.
To solve this, since the resulting logic ends up being the same in the check above, I simply collapsed this check into the one above it.
Reviewed By: fabiomassimo
Differential Revision: D50000788
fbshipit-source-id: da0bf0cb16c98de95f802dfd35bbdf0e935e615f
Summary:
Added a unit test to cover the inconsistency exception catch we added to capture the crashes caused by the new collection view behaviour in iOS 16.4.
The test deliberately puts the collection view state and the model state out of alignment, and then tests that the exception correctly occurs as expected.
Reviewed By: fabiomassimo
Differential Revision: D50072956
fbshipit-source-id: 4097cc0451d55d1a148156c783fe42654821113c
Summary:
## Changes in this pull request
All of the tests started failing today with a cryptic Ruby error. It turns out that a new version of `activesupport`, a dependency of CocoaPods was released and it introduced a bug. CocoaPods wasn't referencing a direct version of `activesupport` required, and so it was automatically trying to pull in this new invalid version.
This PR fixes the issue by explicitly specifying the last known good version of the dependency in the `Gemfile`.
### Checklist
- [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/main/.github/CONTRIBUTING.md)
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1590
Test Plan: Tested and confirmed on my own fork of IGListKit this resolves the CocoaPods issue
Reviewed By: fabiomassimo
Differential Revision: D50013182
Pulled By: TimOliver
fbshipit-source-id: 623eab49dea5ff0b589b6f06ce589e99873dece4
Summary:
## Changes in this pull request
I moved the functions from ` IGListArrayUtilsInternal.h` to `IGListArrayUtilsInternal.m` to ensure the code was properly captured for code coverage, but I forgot to re-run the SPM script to generate a new symlink for it. This should fix the failing sample app build tests.
### Checklist
- [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/main/.github/CONTRIBUTING.md)
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1591
Test Plan: Confirmed this lets the sample apps run again.
Reviewed By: fabiomassimo
Differential Revision: D50013194
Pulled By: TimOliver
fbshipit-source-id: ff4bebae781ebb460915458848cb340a89401a83
Summary:
## Changes in this pull request
Xcode 15 has moved the iOS deployment target up to iOS 12 (just like https://github.com/Instagram/IGListKit/issues/1573 for Xcode 14). I did not modify the changelog because there's already an entry there for iOS 11 and macOS 10.13.
This also includes a build error fix for IGWarnAssert (dffcd4d0c8). I tried running the unit tests but a number of them are failing from previous changes.
### Checklist
- [ ] 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/main/.github/CONTRIBUTING.md)
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1589
Reviewed By: fabiomassimo
Differential Revision: D50013207
Pulled By: TimOliver
fbshipit-source-id: 6c7a7b2ca3dd1265f11e85979432eded3292ed06
Summary: This diff adds a small, essentially no-op test to add coverage to the `isInDataUpdateBlock` method of `IGListReloadDataUpdater`.
Differential Revision: D49906263
fbshipit-source-id: e59a04721d6af58cc2b6148cd688be8225bf3fb8
Summary:
It seems the under-the-hood changes made to `UICollectionView` from iOS 16.4 onwards has changed our expectations of how these tests work.
When initially testing, it seemed that the new behaviour was that the existing cell in the view would get updated, but any newly inserted cells wouldn't be added to the collection view yet.
Thinking this might simply be invalid behaviour when the collection view isn't added to a superview, I added the collection view to a new `UIWindow` instance. When I re-ran the tests again while the view has a superview, all of the views update correctly, and none of them were left in a partial state.
I'm not too sure what the original intent of testing the collection view cells for being in a partially updated state was, but I think we need to reconsider that for this new `UICollectionView` behaviour.
Differential Revision: D49906268
fbshipit-source-id: 7fdc7ba3a534bd49a8a0684888283d2d1eba5912
Summary:
This test started failing in Xcode 15. It looks like now, the default behaviour of `UICollectionView` is to not perform cell sizing until the next layout pass. As such, the sizing of the cells were invalid until `layoutIfNeeded` is first called.
Adding this line to the test brings it back to all of the expected values.
Differential Revision: D49906272
fbshipit-source-id: cc05cb2e105521b2576b2b2013d06e6285f4e8a4
Summary:
`objectsWithDuplicateIdentifiersRemoved` was originally defined as a static function entirely within the `IGListArrayUtilsInternal.h` header. However it appears that Xcode can't perform code coverage analysis on implementation code in header files, so the coverage for this function was getting skipped.
This refactors the function so the code is properly arranged in an implementation file.
Differential Revision: D49901041
fbshipit-source-id: cb409343247451028634ca4d3d7b63e5670b5e1a
Summary: Duplicates an existing test and tests the same circumstances without a section controller `transitionDelegate` set. This causes all the logic to no-op and return the same instance of the original layout attributes object.
Differential Revision: D49900561
fbshipit-source-id: 8f768a998308c1aff73e8195aacdfd70579be601
Summary:
This was another test I originally added to test moving items belonging to sections containing only 1 item as this triggers the codepath to move the whole section.
It turns out this test isn't needed since the codepath is being properly tested in other tests.
Differential Revision: D49900555
fbshipit-source-id: f2586a22ef0f529fcfa10c4ef7d6d065a9a89f7d
Summary:
I'm going through the IGListKit test suite with Xcode 15 and updating the tests that subsequently started failing with the new changes made to `UICollectionView` under the hood.
This was a test I originally added to help add to the code coverage, but it looks like my expectations about how it actually should work were incorrect, and it's now getting flagged by the new `UICollectionView` logic. I stepped through all the state with breakpoints and worked out how this is supposed to work.
Differential Revision: D49898019
fbshipit-source-id: fad21d14f0ae3a0ffbee8dde502114971f35fa1c
Summary:
I'm looking at updating IGKitKit's test suite for Xcode 15, but when I went to do a build, it failed at the `IGWarnAssert` macro. Turns out that because we set the condition in the macro to always return `(NO)`, there's no need to expose `frmt` to test for the condition.
This diff removes `frmt` from the define, allowing the tests to build again.
Reviewed By: fabiomassimo
Differential Revision:
D49628618
Privacy Context Container: L1203725
fbshipit-source-id: b0456a149bf5be96c8401a21866880ccd72ebbcb
Summary: This are not critical enough to trigger an assertion instead of a warning.
Reviewed By: DimaVartanian
Differential Revision: D49326036
fbshipit-source-id: 50bbb6f57208ddea8cc1ead2db3b347f9e0c2f87
Summary: This assertion has been firing for at least the [last 3 months](https://fburl.com/scuba/errorreporting_instagram_ios_assertions/vfxo4h2g) and we have shipped the app anyways so it is definitely not launch blocking.
Reviewed By: fabiomassimo
Differential Revision: D49281317
fbshipit-source-id: d525f88fe676e813b8413a2e0f21b6b12728b359
Summary:
I noticed some strange behaviour in a collection view I was testing that was using `IGListCollectionView` and `IGListCollectionViewLayout`. Even if I called `invalidateLayout` on it, the cells wouldn't resize and would sometimes end up overflowing outside the collection view's bound.
I eventually managed to trace this back to `IGListCollectionViewLayout` that uses a `_minimumInvalidatedSection` flag to track when list content has changed before it starts calling the sizing logic of each section controller. While `invalidateLayoutWithContext:(IGListCollectionViewLayoutInvalidationContext *)context` was correctly setting this flag, `invalidateLayout` wasn't subclassed, and so this call was basically always falling through.
This diff configures `invalidateLayout` to set this flag, so when this method is called, it will correctly perform a new cell sizing pass.
Reviewed By: DimaVartanian
Differential Revision: D47787723
fbshipit-source-id: 724d76ba3e7b5c32b60e7c76347a129c30f0b502
Summary:
The "Tail Loading" example wasn't working correctly on some iPad variants as some of the screens were too large for the number of items in the collection.
This diff:
* Enables scroll bouncing regardless of content size
* Adds more items to the list on iPad to ensure it always has some scrollable height.
* Adds `invalidateLayout()` to view size changes in order to properly handle landscape/portrait rotations.
* Hides the disclosure chevron by default (Since only the Demos view controller when running on iPhone needs it)
Reviewed By: DimaVartanian
Differential Revision: D47662107
fbshipit-source-id: a9b2ee532a84b62a387685da09c5ea532eb2c874
Summary: To demonstrate some more advanced UI customization with IGListKit, and to help make the sample app look more modern, this diff updates the root Demos view controller to adopt the 'grouped inset' style of lists that was introduced in iOS 13.
Reviewed By: DimaVartanian
Differential Revision: D47050305
fbshipit-source-id: e230bea3c98ecb9f547d4fb04b74f32efcb4d986
Summary:
Adds additional polish and refinement to the initial Demos view controller.
* Adds SF Symbols to each section.
* Correctly selects and deselects cells when in and out split view mode.
* Fixes demo table view cell to adapt to safe area insets correctly.
Reviewed By: fabiomassimo
Differential Revision: D45686668
fbshipit-source-id: 5e24120a0aab5cb3fb9c33b0b0d7c087a56d6304
Summary:
As part of the push for a new public release of IGListKit, I thought it'd be a good idea to go back, review the sample apps and provide some visual updates where possible. There are a lot of modern features of iOS and the other platforms that we can use to improve the look of the sample apps for free. 😁
For starters, this diff adds the standard iOS 11 large titles to the view controllers in the iOS sample app.
Reviewed By: fabiomassimo
Differential Revision: D45685793
fbshipit-source-id: f1846cfce32fb4945a6edf5e1a05c4cafd73dacc
Summary:
Follow up to D47263265
## What's happening
We're calling `listAdapter.reloadObjects(...)` in the middle of the IGListKit's internal data update, so it's using the new section index path, instead of the old one. So we're going from a list of 2, insert at 0, and try to reload index 1, then we crash (it'll try to update index 2, which doesn't exist in the old array)
## Fix
Just like for `[IGListAdapter performBatchAnimated:updates:completion:]`, lets use the old index. To get this working, lets ask the updater if we're in an update, rather than `IGListAdapter` try to keep track of it.
Sorry the diff is a bit long, but in case this feels reasonable to pick, I might
Differential Revision: D47281472
fbshipit-source-id: 193153cfc15c87084b67f58c50e921db459d6800
Summary: Added try catch for managing NSInternalInconsistencyException that are now tunneled through our assert flow
Differential Revision: D45995182
fbshipit-source-id: 829d2ea3122c1ed40e25c8da36d1926d27b42418
Summary:
At this point, I think we've migrated most, if not all of the equivalent pipelines from Travis CI over to GitHub Actions.
As part of preparing to launch v5.0, let's do some housecleaning and remove files that aren't being used anymore.
Differential Revision: D45476049
fbshipit-source-id: 423713d72870d20a2c3e0746b1d500e5d95b6340
Summary: There were a lot of placeholder references to the PRs of committed features in the CHANGELOG. I went along each one and tagged each PR/commit that added the feature.
Differential Revision: D45477107
fbshipit-source-id: 4d64366bbafc07de278aaacac7e8558b6483cae4
Summary:
## Changes in this pull request
Issue fixed: #
### Checklist
- [ ] 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)
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1299
Reviewed By: m3rlin45
Differential Revision: D18703628
Pulled By: TimOliver
fbshipit-source-id: d347ed9c59c62ccdb73bd3abd14e289b7c06f3f6
Summary:
## Changes in this pull request
Xcode 14 changed the minimum deployment target to iOS/tvOS 11.0 and macOS 10.13. This PR moves up the deployment targets so that a warning isn't shown on every build.
I also silenced the development region and base localization warnings.
### Checklist
- [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/main/.github/CONTRIBUTING.md)
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1573
Differential Revision: D45223095
Pulled By: TimOliver
fbshipit-source-id: 57fbd284809c09f86a9731d0676332de35fbe0df
Summary: One final tweak to IGListBindingSingleSectionController to ensure proper running with the sample apps on GitHub.
Reviewed By: m3rlin45
Differential Revision: D45170133
fbshipit-source-id: 8b48761962dee79a408cad2e9ffcc55a0fbd550e
Summary: I ran the script needed to update the symlinks needed for SPM support. This removed the symlinks for the files we deleted and added the ones for `IGListBindingSingleSectionController`.
Reviewed By: candance
Differential Revision: D45147897
fbshipit-source-id: e3d351fcefd1f0e193aafc6f6c2af91fefb8c5cb
Summary:
I'm still not sure if there's an easier way to test throwing methods that work on both GitHub Actions and our internal build tooling (Since GitHub does throw at asserts, and our internal tools don't), but this way at least works.
Each statement has to be contained in its own separate `try` because the first throwing method will cancel execution in the rest of the code block.
This diff separates out each throwing test into its own `try` block
Reviewed By: candance
Differential Revision: D45147876
fbshipit-source-id: 95d587d5abe4a695b1ca1f76ebf3bda3984c6065
Summary:
While the `IGListBindingSingleSectionController` class and a nearly complete test suite were present in the IGListKit repo, they weren't imported into Xcode, and so they weren't part of the public release or the test CI.
Since the class looks like it's being used within Instagram, it's clear that it's not deprecated. I'm assuming it was added for a specific use-case in Instagram, and integrating it with the public Xcode project was still pending.
This diff integrates the class back into the public framework.
Reviewed By: candance
Differential Revision: D45147758
fbshipit-source-id: b0a84a2909635a4448480246f315243f4fcac134
Summary: I found a file named `IGListExperimentalAdapterUpdater+DebugDescription.h` that wasn't part of the Xcode project, and had no accompanying implementation file. Since it looks like it's not being used, we can probably just delete it.
Reviewed By: candance
Differential Revision: D45147745
fbshipit-source-id: a1fbc0475c1c6098f03c7ea6a2f6316917c2e677
Summary:
I discovered after committing the last stack of diffs (especially after renaming `IGListReloadDataUpdaterTests`) that some of the other test files weren't included in IGListKit's Xcode project.
This diff updates the project file to include all of the previously unlinked test and source files.
Reviewed By: candance
Differential Revision: D45147042
fbshipit-source-id: 3141e15b7bc1d0431b6286f6d966e88bd8f88f2a
Summary:
I realized halfway through this exercise that the code in the unit tests themselves was also getting counted in the final code coverage stats, and that this was artificially inflating the final number by a pretty big amount.
This diff omits the test suite from the coverage stats.
Reviewed By: candance
Differential Revision: D45022827
fbshipit-source-id: 45a043e70bcc053e07dbeefaa2e3da8a10a982db
Summary: Added making a call to the supplementary view data source in IGTestDelegateController so that codepath gets the same test exposure as the regular cell mechanism.
Reviewed By: candance
Differential Revision: D45004843
fbshipit-source-id: 6d3140ebc59da5ba4b7a151f6f104cdbd63418c2
Summary: Adds additional functionality and coverage testing to the adapter debugger class
Reviewed By: candance
Differential Revision: D45004651
fbshipit-source-id: 40330f5f2fed2946cc5ead89b30cf4030b596b65
Summary: Adds additional test coverage to the collection view and collection view layout test suites
Reviewed By: candance
Differential Revision: D45004591
fbshipit-source-id: 21587df6f9595cb54481067322aae6443e089152
Summary: I reenabled a couple of tests that had previously been marked disabled, but work properly now, and I added additional tests to cover some of the coverage cases that had previously been missed.
Reviewed By: candance
Differential Revision: D45004625
fbshipit-source-id: dacf49b2f0f420f269e3071ad4fc76762c95365c
Summary:
There were several tests in the E2E test suite that had been deliberately disabled. I reenabled them and tested them, and they all passed correctly.
I've left them reenabled in this diff, but we can disable them down the line again if they start to fail again.
Differential Revision: D45004373
fbshipit-source-id: c0bc96e1d364d702d12e945059daedf2ae21cfa5