Skip to content
A data-driven UICollectionView framework for building fast and flexible lists.
Branch: master
Clone or download
Aaron Pang and facebook-github-bot Add experiment to have the collection view layout check the collectio…
…n view instead of the collection view layout [2/2]

Summary:
The collection view layout here should not be accessing the data source directly but instead asking the collection view for the number of sections and number of items. This is because the collection view holds an internal cache and if there is a discrepancy between when the collection view cache and the data source, preparing the layout will crash the app because we will send a layout down to the collection view with a items that might not exist in the collection view's cache but exist in the data source.

This diff adds an experiment to see the impact of fixing this check so that when we prepare layouts we don't ask the data source directly but ask the collection view instead. The collection view will then update it's cache and check the data source so it does not crash when we prepare a layout.

```
NSInternalInconsistencyException at __45-[UICollectionViewData validateLayoutInRect:]_block_invoke:
UICollectionView received layout attributes for a cell with an index path that does not exist:
<NSIndexPath: 0xc198a8c3ea391fbb> {length = 2, path = 4 - 0}
```

Reviewed By: lorixx

Differential Revision: D15830610

fbshipit-source-id: f3dae3e87c55b86c3b686309c1144ccfff1375bf
Latest commit 78cca5b Jun 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Update issue template to ask for example project Dec 7, 2018
Examples Fix travis & upgrade cocoapods (#1317) May 1, 2019
Guides Fix typo (#1224) Jul 25, 2018
IGListKit.xcodeproj Fix #1275 layouts inconsistency in `updateAnimated:completion` of IGL… Jun 12, 2019
IGListKit.xcworkspace Fix "new file header template" whitespace #trivial (#1324) May 20, 2019
Pods Fix travis & upgrade cocoapods (#1317) May 1, 2019
Resources Create binding and modeling guide/tutorial Aug 21, 2017
Source Add experiment to have the collection view layout check the collectio… Jun 14, 2019
Tests Fix #1275 layouts inconsistency in `updateAnimated:completion` of IGL… Jun 12, 2019
docs Regenerate docs for 3.4 May 2, 2018
remodel-plugin Add copyright statement to remodel feature file Jun 12, 2019
scripts Update .travis.yml and lint.sh, try to fix #1060 and lint errors #tri… Feb 2, 2018
.gitignore Nitpicky comment fixes Mar 31, 2017
.slather.yml Ignore Xcode dir in coverage reports Nov 20, 2016
.travis.yml Fix travis & upgrade cocoapods (#1317) May 1, 2019
CHANGELOG.md Fix #1275 layouts inconsistency in `updateAnimated:completion` of IGL… Jun 12, 2019
CODE_OF_CONDUCT.md Add Code of Conduct (#1273) Oct 30, 2018
Dangerfile Update .travis.yml and lint.sh, try to fix #1060 and lint errors #tri… Feb 2, 2018
Gemfile Fix travis & upgrade cocoapods (#1317) May 1, 2019
Gemfile.lock Fix travis & upgrade cocoapods (#1317) May 1, 2019
IGListKit.podspec Update README and podspec with new license, bump version to 3.4 May 1, 2018
LICENSE.md Update MIT license language (#1272) Nov 1, 2018
Package.swift Add support for Swift PM (#1323) May 21, 2019
Podfile Update Travis to Xcode 9.2 #trivial Jan 22, 2018
Podfile.lock Fix travis & upgrade cocoapods (#1317) May 1, 2019
README.md Update README and podspec with new license, bump version to 3.4 May 1, 2018

README.md

Build Status Coverage Status Pods Version Platforms Carthage Compatible


A data-driven UICollectionView framework for building fast and flexible lists.

Main Features
🙅 Never call performBatchUpdates(_:, completion:) or reloadData() again
🏠 Better architecture with reusable cells and components
🔠 Create collections with multiple data types
🔑 Decoupled diffing algorithm
Fully unit tested
🔍 Customize your diffing behavior for your models
📱 Simply UICollectionView at its core
🚀 Extendable API
🐦 Written in Objective-C with full Swift interop support

IGListKit is built and maintained with ❤️ by Instagram engineering. We use the open source version master branch in the Instagram app.

Requirements

  • Xcode 9.0+
  • iOS 8.0+
  • tvOS 9.0+
  • macOS 10.11+ (diffing algorithm components only)
  • Interoperability with Swift 3.0+

Installation

CocoaPods

The preferred installation method is with CocoaPods. Add the following to your Podfile:

pod 'IGListKit', '~> 3.0'

Carthage

For Carthage, add the following to your Cartfile:

github "Instagram/IGListKit" ~> 3.0

For advanced usage, see our Installation Guide.

Getting Started

$ git clone https://github.com/Instagram/IGListKit.git
$ cd IGListKit/
$ ./scripts/setup.sh

Documentation

You can find the docs here. Documentation is generated with jazzy and hosted on GitHub-Pages.

To regenerate docs, run ./scripts/build_docs.sh from the root directory in the repo.

Vision

For the long-term goals and "vision" of IGListKit, please read our Vision doc.

Contributing

Please see the CONTRIBUTING file for how to help. At Instagram, we sync the open source version of IGListKit daily, so we're always testing the latest changes. But that requires all changes be thoroughly tested and follow our style guide.

We have a set of starter tasks that are great for beginners to jump in on and start contributing.

License

IGListKit is MIT-licensed.

The files in the /Examples/ directory are licensed under a separate license as specified in each file. Documentation is licensed CC-BY-4.0.

You can’t perform that action at this time.