Summary:

Noticed an issue when trying to build the examples project that I couldn't because of the Swiftlint build phase (see the image above)
As it turns out in between the version I have installed (0.16.1) and the latest (0.19.0) they've made it so you can drop `lint` from the command (which is the default task).
I see two options really:
1. We add `lint` to the command which at least lets older versions of Swiftlint compile the project without making changes to run phases. It's worth noting that this means that certain (newer) rules won't be detected.
2. We add a way of detecting if they have an older version (likely by comparing the output of `$(swiftlint version)` to the version we know it works on. And display a more appropriate message and not fail the build.
Happy to discuss this
heshamsalman jessesquires rnystrom
Closes https://github.com/Instagram/IGListKit/pull/796
Differential Revision: D5137557
Pulled By: rnystrom
fbshipit-source-id: b6c85197d7a66e37976d66b646c9c9241827ce42
Summary:
Replaces #642, #681
Issue ref: #394
Changes from last PR:
- Deleted the shared SwiftLint folder, incl. all files (On the plus side, did this in the quest to get this PR in https://github.com/realm/SwiftLint/pull/1513)
- Changed the build script such that it runs the user's `HomeBrew` installation of SwiftLint instead of the local copy
Integrates SwiftLint into DangerBot.
You may want to append a ?w=1 to the end of the files-changed url to exclude whitespace-only changes.
- [ ] 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/741
Differential Revision: D5068134
Pulled By: jessesquires
fbshipit-source-id: 68d6a57e0072672e38eeb94908d00f26bbd68fbc
Summary:
~~Land after #661, #730 and D5031184~~
Rebuild the docs from script. Couple notes:
- Went from 100% to 99%, does that matter? Script output says
- > 99% documentation coverage with 2 undocumented symbols
- Looks like `NS_SWIFT_NAME` throws documentation for a loop on `IGListDiffOption` and `IGListExperiment`
- Swift names are different, will that be a problem?
Part of #707
Closes https://github.com/Instagram/IGListKit/pull/728
Differential Revision: D5050951
Pulled By: jessesquires
fbshipit-source-id: 19249c1d34e6f253b911965114fd4ae7458d2684
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
Summary:
Regen example projects w/ pod script file.
Part of #707
Reviewed By: jessesquires
Differential Revision: D5039135
fbshipit-source-id: d29bcf635aea59aa589bd90644fb1ece6279cc10
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
Summary:
This pull request removes the `sectionForSectionController:` method from the `IGListCollectionContext` protocol so that the protocol is exclusively for presentation methods.
This should not add new functionality, but rather makes the index directly accessible on the section controllers themselves. This change makes sense because at no time will there be an update to the list that the list adapter is unaware of and so it will always be able to set and update any indexes for a section controller that has changed.
Issue fixed: #609
- [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/671
Reviewed By: jessesquires
Differential Revision: D4942159
Pulled By: amonshiz
fbshipit-source-id: d648cfdd381cbf1d9ee7ff549ae27d2972a84622
Summary:
These tests are timing out all the time. ☠️
Issue fixed: #683
Closes https://github.com/Instagram/IGListKit/pull/688
Differential Revision: D4965525
Pulled By: rnystrom
fbshipit-source-id: ea122e66379646c557d1b8f1c7325894620b88fb
Summary:
Issue fixed: #414
- [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)
What should we do with testing? I changed all the occurrences of the old initializer with the new one, so I think this is good to go?
Closes https://github.com/Instagram/IGListKit/pull/686
Differential Revision: D4931986
Pulled By: jessesquires
fbshipit-source-id: d6f0ac6578c11f8ef37ec0e385bc110e3abd7c91
Summary:
a415ef5552 exposed a bug in `UICollectionView` where its state gets corrupted when deleting the same index path more than once in a single batch update block. This resulted crashes like
```
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x4)
Closes https://github.com/Instagram/IGListKit/pull/657
Reviewed By: jessesquires
Differential Revision: D4913790
Pulled By: rnystrom
fbshipit-source-id: 8f6fcdd2e2438da309fc64ca0ac111b9a0980149
Summary: Adding and implementing an example of a new section controller that can be configured with a type. This section controller automatically stores its object in `didUpdateToObject:`, and implementations can trust the type-safety of the object!
Reviewed By: jessesquires
Differential Revision: D4914179
fbshipit-source-id: 39e2dce8ca29a1c0c92dc78eb8c25a7ab0a21978
Summary:
This reduces the quantity of the code within IGListAdapter.m and is a bit more in line with Swift style of putting protocol conformance into extensions.
This does not change functionality just rearranges where code lives.
- [X] All tests pass. Demo project builds and runs.
- [X] I added tests, an experiment, or detailed why my change isn't tested.
- [N/A] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [N/A] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/599
Reviewed By: jessesquires
Differential Revision: D4861777
Pulled By: amonshiz
fbshipit-source-id: eaa31aa9438f3892193aeb8b4ae580ba2960ee8b
Summary:
Collection view layout has "user defined runtime attributes" which were left over from the old IG grid layout. I've removed them as we don't use them any more.
Also I couldn't build the project because of the map function in the dependency injection example, so changed that slightly to make it run (tested that and still works)
Issue fixed: #656
Closes https://github.com/Instagram/IGListKit/pull/658
Differential Revision: D4899250
Pulled By: jessesquires
fbshipit-source-id: 04f15399732ce07c6026d07801e228de5d5e47ab
Summary:
Original comment:
If you insert or delete into the same index twice **and** update your data source to reflect those changes, we will squash the insert/delete into a single update because we're using `NSSet` internally.
This becomes very apparent when multiple updates are coalesced.
Issue fixed: #483
- [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/634
Differential Revision: D4860479
Pulled By: jessesquires
fbshipit-source-id: 3aa271d90fca21b11201f62cefa8d7fbcef6930f
Summary:
Issue fixed: #618
- [ ] 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/637
Differential Revision: D4869624
Pulled By: jessesquires
fbshipit-source-id: a9d5623dbb7a032691f3af5a2abf61adc3a42cd0
Summary:
I saw some `!` in the Swift example that we can remove 🙂
Same as I mentioned in my last PR, the iOS examples project can't be opened on my machine, but I believe I updated the examples to be compatible.
Closes https://github.com/Instagram/IGListKit/pull/626
Differential Revision: D4860165
Pulled By: jessesquires
fbshipit-source-id: 74bcac8fc759da8105e658901c3df9e71afc609f
Summary:
Issue fixed: #630
- [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/631
Differential Revision: D4860116
Pulled By: jessesquires
fbshipit-source-id: 8138b50106ae06e06c643ba74451c511f38b0b98
Summary:
Created a new demo that shows off how to:
- Inject dependencies to section controllers
- Objects shared between section controllers
- Things that aren't the core "object"
- Announce changes from the VC that make their way to the section controllers
- Without calling updates
Closes https://github.com/Instagram/IGListKit/pull/612
Differential Revision: D4827188
Pulled By: rnystrom
fbshipit-source-id: 9575df0e105fd06f9a59db49432b19e8b824e0e3
Summary:
PR #602 added generics to `IGListBindingSectionController` in the ObjC code but did not update the Swift Examples. Swift fails to compile without any form of generic specification.
Fixed example compilation.
- [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.
- [ ] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/608
Differential Revision: D4818132
Pulled By: rnystrom
fbshipit-source-id: 8ccdab044ac68d2a95085faedf683ac1b882cbff
Summary:
Take 2. Remove `IGListCollectionView` per #409. Use plain old `UICollectionView`.
(This re-applies D4640425 and updates as needed.)
Also:
- run `pod update` everywhere
- update changelog
Reviewed By: paulvanderspek
Differential Revision: D4812207
fbshipit-source-id: 1ddbae06cdeddb43d8af175d3e8a045a36ff150e
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
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
Summary:
- The recent addition of `IGListCollectionViewLayoutInternal.h` in a80245a696 broke the example project. This PR fixes this.
- Name sorted the internal files
- [x] All tests pass. Demo project builds and runs.
- [x] Why didnt Travis catch this? 🤔
- [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/569
Differential Revision: D4740682
Pulled By: rnystrom
fbshipit-source-id: 2c57d03f9751d14edf35741eaa97d0ae8a2f167a
Summary:
Started work on the plane to get this moving since #418 is up and ready to land. We'll likely need to spend some time fleshing out the API of this, and I think I'll split it up into a couple different PRs once ready for review. Putting this up now to get early feedback.
This adds an auto-diffing section controller as outlined in #38. There are several key parts:
- Subclass a new section controller `IGListAutoSectionController` (naming wip)
- Connect a data source
- Implement the data source methods that do 3 things:
- Given a top-level object, transform it into an array of **diffable** view models
- Given a view model, return a cell
- Given a view model, return a size for a cell
- A new protocol for the cell `IGListBindable` so that we can control when the cell is updated w/ the view model.
- The most important part of this is that it unlocks moving and reloading a cell, which you can't do w/ `UICollectionView`
- [ ] Unit test `reloadObjects:`
- [x] Add
Closes https://github.com/Instagram/IGListKit/pull/494
Reviewed By: amonshiz
Differential Revision: D4696966
Pulled By: rnystrom
fbshipit-source-id: f21b8341b3ed4389f2a4a106d0d316f481ba6943
Summary:
You are already using `final class` as the default swift declaration as I guess most people agree this is best practice for classes you are not planning to inherit from :) So I just made the example code more consistent.
I will not add much more reasoning to why, other than open source projects like this is a _big_ inspirations and starting ground to play with swift for new develoeprs joining the iOS community. Nuding them to ask the right questions (composition vs inheritance) early could only be a good thing (?)
- [X] All tests pass. Demo project builds and runs.
- [X] No new tests. No new classes.
- [X] No breaking changes.
- [X] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/539
Differential Revision: D4696591
Pulled By: rnystrom
fbshipit-source-id: 73539b907452ec0cb7a8e842a95cb4fd27138f2f
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
Summary:
Follow from #450, this layout has been replaced. You served us well!
- [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/482
Differential Revision: D4553897
Pulled By: rnystrom
fbshipit-source-id: caccb386ba8914fbbf5e81d997524efb78c6e4ea
Summary:
Working on porting our collection view layout to IGListKit. I'm doing this because its a solid layout, and we just finished preparing it to work with inline sections. It is designed to work in tandem with IGListKit, so we're adding it.
This is still a WIP as I add more tests, but I'd love as much feedback as possible.
Aside from the glob of header documentation, this has the following features:
- Infinite sections that each have infinite items. Sections and items can fall inline. When they break the width of their container they will fall on the next row.
- Sections can have their own insets, line spacing, and interitem spacing.
- Sticky header support! When you use headers, it will always newline the section.
- Maximum width with a border decoration view
- Use this to pinch in your content on larger devices
Followup to #423
- [ ] ~~Move decoration view support to delegate~~ removed
- [x] Unit test changing [top y sticky inset](https://coveralls.io/builds/9977284/source?filen
Closes https://github.com/Instagram/IGListKit/pull/484
Differential Revision: D4547760
Pulled By: rnystrom
fbshipit-source-id: 879e2da16eb78bb6a90967e77d9ad0bbf7c69594
Summary:
Working on porting our collection view layout to IGListKit. I'm doing this because its a solid layout, and we just finished preparing it to work with inline sections. It is designed to work in tandem with IGListKit, so we're adding it.
This is still a WIP as I add more tests, but I'd love as much feedback as possible.
Aside from the glob of header documentation, this has the following features:
- Infinite sections that each have infinite items. Sections and items can fall inline. When they break the width of their container they will fall on the next row.
- Sections can have their own insets, line spacing, and interitem spacing.
- Sticky header support! When you use headers, it will always newline the section.
- Maximum width with a border decoration view
- Use this to pinch in your content on larger devices
Followup to #423
- [ ] ~~Move decoration view support to delegate~~ removed
- [x] Unit test changing [top y sticky inset](https://coveralls.io/builds/9977284/source?filen
Closes https://github.com/Instagram/IGListKit/pull/450
Reviewed By: jessesquires
Differential Revision: D4521797
Pulled By: rnystrom
fbshipit-source-id: 20b36ae573d38ca3125a6f3d5faec181c290ab94
Summary:
- Updated selectionDelegate to pass through the model object
- Changelog entry under 3.0.0 as is breaking change
Try saying single section selection 10 times quick
Dabbing my left toe into some ObjC, so apologies if I violate years of rules
- [ ] Update documentation internally
Closes#396
- [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/397
Differential Revision: D4406213
Pulled By: rnystrom
fbshipit-source-id: ba468fa49e75823796a47da6ed7f0e8957db3d75
Summary:
Changed the criteria for starting search in the OS X Example. Closes https://github.com/Instagram/IGListKit/issues/371
Doesn't look like there are tests for the example app. Please ping me if you'd like me to add some. Also, please ping me if you'd like me to add this change to the changelog -- I'm assuming bug fixes to sample apps don't get included there.
- [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/377
Differential Revision: D4374006
Pulled By: jessesquires
fbshipit-source-id: 6e20f61aece769240aa63c8949d3c06a0ecd26c8
Summary:
Worth noting that while we support 10.8 and newer, Swift support is only 10.9 and newer. There were only a few more errors for 10.9 deployment target, but I'm not familiar with how it all works.
Using an `available` to disable row actions for users on 10.10 (only available for 10.11 and newer).
Closes https://github.com/Instagram/IGListKit/pull/374
Differential Revision: D4372977
Pulled By: jessesquires
fbshipit-source-id: 19f4b50c8eb4aa92f80241d69c44a367e854f5e8
Summary:
So the main Podspec file now has two Subspecs, `Diffing` and for lack of better name `Default`. `Diffing` is purely the files within the common directories (used for Diffing, if in the future we support MacOS NSCollectionView then this may need changing). `Default` depends on `Diffing` but also adds all the non-common files.
To use it via CocoaPods, nothing changes. You `import IGListKit` and you will only have access to the files in the pod you use. (So if you use `IGListKit/Diffing` in your Podfile, then you will only get access to the diffing files). If you do a manual installation, or I assume via Carthage, then you will need to import the correct header file (either `IGListDiffKit.h` or `IGListKit.h` depending on what you want).
Turns out CocoaPods creates it's own umbrella header (unless you tell it otherwise) meaning our ones are unused by it.
Just to confirm `IGListKit` in your Podfile will give you everything, only if you add `/Diffing` will you "opt-out" o
Closes https://github.com/Instagram/IGListKit/pull/368
Differential Revision: D4367438
Pulled By: jessesquires
fbshipit-source-id: 272318ca551e7e8c4177ca3ca501fde23bd9705a
Summary:
- Added IGListCompatibility.h file, and imported it in the files where we need the target check.
- Ordered the project by type
In "IGListKit.h" we still have the conditional check for `#if TARGET_OS_EMBEDDED || TARGET_OS_SIMULATOR` - Did we want to make a macro or something for this check?
This is the most Obj-C I've ever done... just felt that was a worthy comment.
Closes#364
- [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/369
Differential Revision: D4366344
Pulled By: jessesquires
fbshipit-source-id: f0a6168b8965ded22a641814797fbdec92ca1c36
Summary:
Adding a pretty basic stacked demo. 3 different sections, each with 3 child section controllers that handle an `Int` data.
Requires #354 to be fully functional (working range).
Closes#134
- [x] All tests pass. Demo project builds and runs.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/355
Differential Revision: D4363859
Pulled By: jessesquires
fbshipit-source-id: 5dbc8e18388fed4930f189e3477ff57f0edf2d13
Summary:
- Add missing common files
- Fix podspec for common files
- Pod install all examples
Reviewed By: rnystrom
Differential Revision: D4350871
fbshipit-source-id: 708ebe6ce66caed75af5b2ac18920dcf45567d16
Summary:
Moving files to `Common` dir so changes are more automated with Buck and easier to manage in the long run. Ran `pod install` on test and example targets. Updated buck file to include `Common` so diffing lib still works.
Part of #270
Reviewed By: jessesquires
Differential Revision: D4346722
fbshipit-source-id: 366d89f6dd571b158b5fccd542080c51517ed341