Summary: Introduces a compositional layout example that leverages section controller methods to determine layout.
Differential Revision: D71402637
fbshipit-source-id: 1179abf13157fb5cb78c8a9086718d1216fb4276
Summary: Lets go even beyond the `MixedDataViewController` example by taking advantage of `orthogonalScrollingBehavior`. Really neat!
Differential Revision: D52260531
fbshipit-source-id: aee8b38a38284104fa65ba8d33426a9e6216e503
Summary:
Lets try using `UICollectionViewCompositionalLayout` with IGListKit! It does require some data plumbing, but maybe we can make that simpler in the future. For now, lets keep things simple and see how it feels.
This diff replicates the `MixedDataViewController` example starting with the expandable text.
Differential Revision: D52260529
fbshipit-source-id: 5579b8d6fe5d1f95ed282f821e6555a6a56b1c1c
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:
The standardized Meta copyright notice is "Copyright (c) Meta Platforms, Inc. and affiliates." and not "Copyright (c) Meta Platforms, Inc. and its affiliates." (Dropping the "its")
This diff updates the copyright notice in each source file to the correct this.
Reviewed By: willbailey
Differential Revision: D44737667
fbshipit-source-id: 643bf36df76723e70d9d826c53cf8f29b8a0c8cc
Summary:
This diff imports and refines the PR made by cntrump on GitHub.
The PR introduces the following:
* Sample apps now use SPM instead of CocoaPods to import IGListKit.
* Adds Mac Catalyst as an example target.
* Adds C++ flags to the CocoaPods specs.
* Fixes a script issue that was discovered when regenerating the symlinks.
The PR originally aimed to remove the need for symlinked references to the IGListKit and IGListDiffKit source files, but in testing, I couldn't get it working. It's possible SPM being too strict [on where the headers can be placed to be discovered](https://forums.swift.org/t/how-do-i-specify-the-headers-directory-for-a-objc-target-in-swift-package-managers-package-swift/58531/3).
Additionally, another issue was that the original PR changed all of the `#import` statements to the the modular `import` statements, which is fine for the sample apps, but ended up breaking compatibility for any apps that had modules disabled.
## Changes in this pull request
Improve SwiftPM support:
Build module `IGListDiffKit` and `IGListKit` as Objective-C++.
module `IGListDiffKit`:
- Source/IGListDiffKit
- module defined in `Source/IGListDiffKit/modulemap/module.modulemap`
- requires `-fmodules` and `-fcxx-modules`
module `IGListKit`:
- depend on `IGListDiffKit`, use `import IGListDiffKit;`
- Source/IGListKit
- module defined in `Source/IGListKit/modulemap/module.modulemap`
- requires `-fmodules` and `-fcxx-modules`
module `IGListSwiftKit`:
- depend on `IGListKit`, use `import IGListKit`
- Source/IGListSwiftKit
Deleted `spm/` and `scripts/generate_spm_sources_layout.sh`, it is unnecessary.
Updated `.podspec`, add `'OTHER_CFLAGS' => '-fmodules'` and `'OTHER_CPLUSPLUSFLAGS' => '-fcxx-modules'`.
Add missing swift files for `IGListSwiftKit` in `IGListKit.xcodeproj`
### How to use
Replace `#import <IGListDiffKit/IGListDiffKit.h>` with `import IGListDiffKit;`, because `IGListDiffKit.h` isn't exist in `modulemap/`, Or create a symbol link by `ln -sf ../IGListDiffKit.h` for support it ?
### Examples
Use SwiftPM for building examples.
### Checklist
- [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)
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1546
Test Plan: Test PR showing running tests: https://github.com/TimOliver/IGListKit/actions/runs/4339956050/jobs/7578047058
Reviewed By: lorixx
Differential Revision: D33592395
Pulled By: TimOliver
fbshipit-source-id: 8f7b1873f2b1c6a80908bb55b123e31bea13bb0c
Summary:
A quick push to fix something I noticed while studying how IGListKit works. This simply replaces "Facebook, Inc" with "Meta Platforms, Inc" in all of the source files where the company copyright notice is posted. This should help bring our external facing projects more in line with our new corporate branding.
There's still a lot more references to "Facebook" as a company in the library (especially around linking to other Meta sponsored open source libraries), but this might need additional scrutiny and review on a case-by-case basis, so let's handle those ones separately.
Reviewed By: lorixx
Differential Revision: D41207363
fbshipit-source-id: 57cdbf5eb1023b41a5f32c0c05e01628686a19fe
Summary:
## Changes in this pull request
### 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/master/.github/CONTRIBUTING.md)
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1453
Reviewed By: lorixx
Differential Revision: D23836038
Pulled By: joetam
fbshipit-source-id: 8245415992a5b1ed49f67ebfcf9f85a2745a8042
Summary: Swift 5 came out a while ago, we should definitely be targeting it.
Reviewed By: lorixx
Differential Revision: D19141252
fbshipit-source-id: d6f8fc5209e721a8b28e569855b5e3cc8b8c3431
Summary:
Issue fixed: SwiftLint warnings
- [x] Operator Usage Whitespace Violation: Operators should be surrounded by a single whitespace when they are being used. (operator_usage_whitespace)
- [x] Sorted Imports Violation: Imports should be sorted. (sorted_imports)
- [x] Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
- [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)
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1283
Differential Revision: D13237028
Pulled By: rnystrom
fbshipit-source-id: b364f329b0e99ca56704d3d2851cf225759b2a78
Summary:
I had a desire for interactive reordering in a personal project, so here's a first attempt at adding support in IGListKit.
I figured I might as well get a WIP PR up for comments before I continue further as there are a few aspects to interactive reordering that don't interplay perfectly with IGListKit.
As discussed in #291, I went after two prime use cases:
1. Moving items amongst a section
2. Rearranging whole sections
I also "disabled" moving items between sections by having those moves revert, to mimic interactive reordering cancellation as closely as possible.
You can see both in the Mixed Data example. Grid items can be moved within a section, while users can be moved to reorder whole sections. But trying to move a grid item out of a grid or a user item into a grid will auto-revert. The revert animation isn't as tight as it should be. It may be more desirable to disable the animation - though you lose the visual cue.
There is a also a new example, `ReorderableViewController`, that demonstrates 2 in its pure form (likely the most desired use case), where all sections are reorderable single rows.
Happy to take feedback -- this is my first experience working on IGListKit, so I would expect there to be gaps. (Ex. I haven't used `IGListStackedSectionController`, and its tests failed as I hadn't implemented reordering delegates for it. Those are simply stubbed out for now.)
Issue fixed: #291
- [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] Proper support in `IGListStackedSectionController`
Closes https://github.com/Instagram/IGListKit/pull/976
Differential Revision: D6674493
Pulled By: rnystrom
fbshipit-source-id: cd53c5fdc6fb59636edc4747c4bbd0f81a4610e5
Summary:
Adds the source for a remodel plugin to autogenerate models conforming to `IGListDIffable`.
- [x] All tests pass. Demo project builds and runs. (source untouched, purely additive)
- [x] I added remodel plugin tests + and a new guide explaining the installation + usage
- [ ] 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/1083
Reviewed By: rnystrom
Differential Revision: D6937925
Pulled By: calimarkus
fbshipit-source-id: 54228cddf387cf20ceceec1732e439ab6fd4b984
Summary:
- Updates to SwiftLint 0.24.2
- Improve `scripts/lint.sh`
- pull version out to a var for easier maintenance
- better error message
- make script fail xcode build if not installed (so we don't commit lint errors)
- Adds a few new SwiftLint rules
- Correct all new lint errors (most can be done by running `swiftlint autocorrect`)
- Cleans up `.swiftlint.yml`
- Fix up example projects
Closes https://github.com/Instagram/IGListKit/pull/1058
Differential Revision: D6776177
Pulled By: rnystrom
fbshipit-source-id: 345172237b97aaed0d62312c8f366f46145f8cd9
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:
I have updated the Search Autocomplete example which stopped working as the words don't have unique `diffIdentifier`'s. This caused by the check that good introduced to ensure all objects assigned to a section controller are unique. Fixed this issue by removing all the double words.
- [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/835
Differential Revision: D5353304
Pulled By: rnystrom
fbshipit-source-id: 78cb394469832bd77df7e0cd455a24e46671ba69
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:
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:
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:
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:
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:
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:
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 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:
- 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:
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: Removing the category entirely (recreated for unit tests and examples). Went through and updated all of Instagram so we don't rely on the category and found a few models that needed cleaning up.
Reviewed By: jessesquires
Differential Revision: D4206552
fbshipit-source-id: ee8147e8872ea19f6c8bd8072df61eed5bffb6f3
Summary:
Rebase from #140:
Create a flow layout for IGList that does not newline sections. Closes#3
- [x] Minimum inter-item spacing
- [x] Minimum line spacing
- [x] Constant item size with constant layout time
- [x] Update layout on insert/delete/move
- [x] Unit Test
Closes https://github.com/Instagram/IGListKit/pull/225
Differential Revision: D4211469
Pulled By: rnystrom
fbshipit-source-id: f4710dbf195701098ac50f94b6b2aa8c801b2a83
Summary:
`SingleSectionStoryboardViewController` class should be used rather using `SingleSectionViewController` class twice in `DemosViewController` class
- [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 have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/220
Differential Revision: D4204505
Pulled By: rnystrom
fbshipit-source-id: d70922d57943eab5275af1b939176307c8c3cbeb