Commit graph

130 commits

Author SHA1 Message Date
Tim Oliver
e965f28515 Refine "Load More" view controller for iPad
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
2023-07-25 09:17:11 -07:00
Tim Oliver
71d06d54c1 Convert Demos to rounded group style
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
2023-07-25 09:17:11 -07:00
Tim Oliver
6ab6109779 Polish Demos view controller
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
2023-07-19 22:08:21 -07:00
Tim Oliver
1e48bf9141 Add split mode to iPad
Summary: Updates the sample iOS app with `UISplitViewController` to enable split view functionality on iPad, and larger screen iPhones.

Reviewed By: fabiomassimo

Differential Revision: D45687142

fbshipit-source-id: 171cf7f3306b64db92216dded5c129fa15fd97b3
2023-07-19 22:08:21 -07:00
Tim Oliver
6f8c494060 Add iOS 11 large titles
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
2023-07-19 22:08:21 -07:00
Kent Sutherland
3cd3a111dd Update deployment targets to silence Xcode 14 warnings (#1573)
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
2023-05-01 22:48:23 -07:00
Tim Oliver
f92b9339ee Standarize the copyright notice in all source files
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
2023-04-06 02:44:16 -07:00
Tim Oliver
9e457c39da Update SwiftLint and make it an optional dependency
Summary:
Fixes one final friction point for the IGListKit sample apps: SwiftLint.

At the moment, building the sample apps will hard fail if SwiftLint isn't presently installed. This is generally a good thing when adding new code to the sample apps, but for developers who might want to simply run the sample apps to try out IGListKit, this potentially adds additional unneeded friction.

Since SwiftLint also runs on each incoming PR on GitHub Actions now, even if a third party contributor submits code that they didn't lint themselves, it will still be verified by the CI.

This diff:

* Updates `lint.sh` to check for the latest version of SwiftLint.
* Makes the message that appears if SwiftLint isn't present a warning, instead of an error.
* Adds the linting script to building the `IGListSwiftKit` framework targets as well.

Differential Revision: D43864872

fbshipit-source-id: f5cc18f3612795ad1cc15cc4b7c0dfd7102639c6
2023-03-13 00:49:15 -07:00
Lvv.me
c9e045c942 Improve SwiftPM support (#1546)
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
2023-03-06 23:29:41 -08:00
Tim Oliver
f8a339ce16 Updated and reintegrated Danger into GitHub Actions CI
Summary:
Danger is the build tool we've been using to proof-check incoming PRs, including making sure the incoming change is properly documented, and if needed, running SwiftLint on incoming Swift code.

Danger was originally running in our Travis CI implementation, but it wasn't integrated when we switched to GitHub Actions.

This diff updates our Danger dependencies to the latest versions, and integrates Danger into our CI system as a separate build step. I've also modified its SwiftLint setup so it will now lint Swift files in both our sample apps, and the Swift source files in `IGListSwiftKit` itself.

Reviewed By: candance

Differential Revision: D43265158

fbshipit-source-id: 8939b821af36b544fe4d66662b6ce0f99a8f768c
2023-02-28 18:53:02 -08:00
Tim Oliver
a1b9c2ddb3 Updated corporate branding in IGListKit source files
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
2022-11-15 21:47:29 -08:00
Lvv.me
2f37d18be3 Fix Carthage build issue (#1531)
Summary:
## Changes in this pull request

Issue fixed:
- Fix Carthage build issue.
- Remove useless Pod files.

### 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/1531

Reviewed By: Ziewvater

Differential Revision: D31192872

Pulled By: lorixx

fbshipit-source-id: f0aa6fa1a9b3550c352cc15433f8a2a24551bc4c
2021-09-30 16:04:18 -07:00
Zhisheng Huang
237f76c9bf Fix the slather
Summary:
Run
```
bundle update slather
```

Differential Revision: D30349860

fbshipit-source-id: 9c7334125a4916e8ffd74556649c0570fa76a241
2021-08-16 15:11:33 -07:00
3a4oT
cd0fe69983 Run tests from Xcode12. Github workflow (#1478)
Summary:
## Changes in this pull request

- set header `IGListAdapterUpdaterCompatible.h` to - public which fixed Xcode 12 unit test iOS build.
- include `IGListTransitionData.m` to tvOS trget which fixed Xcode 12 tvOS framework build.
- Added GitHub workflow `CI`.

### 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/1478

Reviewed By: candance

Differential Revision: D25504500

Pulled By: lorixx

fbshipit-source-id: 91f477838f176f662dd74928b75df670a4106968
2021-08-16 13:36:42 -07:00
Jian Chen
c7c8f38638 Add <IGListDiffable> to isEqualToDiffableObject method argument type
Summary:
This method generated using the remodel generation script does not match with the header file.

 The method declared in .h file is:
    - (BOOL)isEqualToDiffableObject:(nullable id<IGListDiffable>)object;

But implementation generated in .m file is:
    - (BOOL)isEqualToDiffableObject:(nullable id)object
    {
        return [self isEqual:object];
    }

This fix is to generate the implementation as:
    - (BOOL)isEqualToDiffableObject:(nullable id<IGListDiffable>)object
    {
        return [self isEqual:object];
    }

Reviewed By: natestedman

Differential Revision: D27146804

fbshipit-source-id: f7d0d598e97e0ef47948b973ff38d9a319cd4b0d
2021-03-18 02:20:45 -07:00
Vivian Phung
f4013b4ffe IGListCollectionContext Examples
Summary: IGListCollectionContext Examples

Reviewed By: natestedman

Differential Revision: D26267044

fbshipit-source-id: 9f940922d7cb22283d6fcf1ac7354edcd966676b
2021-02-05 09:36:53 -08:00
Nate Stedman
64d9bc570b Add refined Swift wrapper for IGListSingleSectionController
Summary: This API is dependent on dynamic types right now, making it awkward and unsafe to use in Swift. By providing a generic wrapper, we can make it safer to use.

Reviewed By: joetam

Differential Revision: D26057302

fbshipit-source-id: ec5d5ed202900f6171761214900fde1f9615e7f5
2021-01-26 07:34:31 -08:00
Maxime Ollivier
2d8827f96e fix example projects
Summary: Run `pod install` on each project

Reviewed By: Haud, lorixx

Differential Revision: D25962431

fbshipit-source-id: 0cff259d798ba6e2b96408d29639665ea3245596
2021-01-21 19:58:49 -08:00
Maxime Ollivier
247e7cac65 ship the new updater
Summary:
It's time to ship the new updater! `IGListExperimentalAdapterUpdater` has been running on Instagram for a couple months with better performance and stability. In this diff, we're renaming `IGListExperimentalAdapterUpdater` (and related classes) to `IGListAdapterUpdater`.

Here's a recap:

## Stability

* `[IGListAdapter setDataSource]` isn't safe
  * We're changing the underlying data without telling the `UICollectionView`.
  * Fix: Lets invalidate the `UICollectionView` data by changing its dataSource.
* `[IGListAdapter setCollectionView]` isn't safe
  * This is synchronous, but we might have pending or on-going updates. The `UICollectionView` might get synced before the pending update actually start executing, so the diff results will be off.
  * Fix: Lets wrap updates in a transaction that can be cancelled.
* Returning a nil `IGListSectionController` from `IGListAdapterDataSource` could crash
  * The `IGListAdapterUpdater` will still perform the diffing assuming that all the objects will have a section, which isn't the case.
  * Fix: Lets generate the `IGListSectionController` before the diffing.
* Other improvements
  * Lets ask for the `fromObject` just before diffing, instead of asking when scheduling the update.
  * If the `UICollectionView` section count doesn't match `fromObject`, lets fallback to a reload.

## Performance

* Re-test background diffing
  * `IGListExperimentBackgroundDiffing` and coalescing updates wasn't safe because of the issues mentioned above. The longer we wait, the more likely we'll end up in a race condition. Lets try re-testing with the stability improvements.
* Unblocks background layout calculation
  * This is a larger project, but these improvements are required to make background work safe.
* Only create the `backgroundView` if needed (although this doesn't really require the new updater)

## Other

* Transactions
  * `IGListAdapterUpdater` is the workhorse of `IGListKit` and has become a bit hard to follow over the years. We want to break it apart into simpler, more manageable parts.
* Avoid blocks
  * There's a lot of blocks flying around, making crash logs hard to read. Lets try to use methods/functions where possible.

Reviewed By: Haud, lorixx

Differential Revision: D25884782

fbshipit-source-id: 1357fa23513a239051d5b1766823effa3199f656
2021-01-21 19:58:47 -08:00
dirtmelon
019b22da07 Adapts to dark mode for iOS example project. (#1453)
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
2020-10-03 01:39:08 -07:00
ccworld1000@gmail.com
3523e72e41 CCAutoTag : Chinese README translate (#1228)
Summary:
Chinese README translate

Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1228

Reviewed By: calimarkus

Differential Revision: D15962545

Pulled By: lorixx

fbshipit-source-id: 37c8f5921547b84e738813643764a2a25534d05e
2020-09-29 10:39:01 -07:00
Maxime Ollivier
8c839d28c7 udpate xcodeproj and example projects
Summary:
* Added new files to xcodeproj
* Ran `pod install` on example projects

Reviewed By: natestedman

Differential Revision: D23542185

fbshipit-source-id: e0d03f915fa0861860d8ffc2ab8701d761d27069
2020-09-08 09:11:12 -07:00
Christian Tietze
8f3a89412c fix cell height in macOS sample projects (#1445)
Summary:
## Changes in this pull request

The macOS sample project used to cut off descenders of the letters "y" and "g". I adjusted the programmatic cell height to match the Nib, and recenter the components vertically.

| Before | After |
| ---- |  ---- |
| ![image](https://user-images.githubusercontent.com/59080/87017842-caeb5480-c1d0-11ea-8c58-5d396ddd6081.png) | ![Screen Shot 2020-07-09 at 10 35 15](https://user-images.githubusercontent.com/59080/87017936-ea827d00-c1d0-11ea-9705-ab26b7e63c64.png) |

### 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.
    - This doesn't sound newsworthy :)
- [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/1445

Reviewed By: joetam

Differential Revision: D22950519

Pulled By: bdotdub

fbshipit-source-id: 506df3ab158dae52d7d86695d602cca47bc420c3
2020-08-06 10:14:53 -07:00
Zhisheng Huang
0cda9dde2b Run ./script/setup.sh to generate project files (#1431)
Summary:
## Changes in this pull request

Run ./script/setup.sh to regenerate some of the Example projects missing files, that are causing the build failure in travis CI. Let's see how it goes.

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/1431

Reviewed By: bdotdub

Differential Revision: D20119287

Pulled By: lorixx

fbshipit-source-id: c9b22b513a248c6428f4730f620f8d72ff37a560
2020-02-26 12:26:58 -08:00
Nate Stedman
1a44045dce Run lint on IGListKit
Differential Revision: D19141253

fbshipit-source-id: 9ed4c278a91bb48a1f6d33cafa9ce8f21861573d
2019-12-19 09:34:42 -08:00
Koen Punt
f1ceedc39b Refine dequeueReusableCellOfClass methods for Swift (#1388)
Summary:
## Changes in this pull request

Initial suggested implementation for https://github.com/Instagram/IGListKit/issues/1387.

### 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/1388

Reviewed By: lorixx

Differential Revision: D18687735

Pulled By: natestedman

fbshipit-source-id: f9cc70ced3f788771fd3f0443b56befbedb04166
2019-12-19 08:13:22 -08:00
Nate Stedman
d4ec467bac Update examples and tests to Swift 5
Summary: Swift 5 came out a while ago, we should definitely be targeting it.

Reviewed By: lorixx

Differential Revision: D19141252

fbshipit-source-id: d6f8fc5209e721a8b28e569855b5e3cc8b8c3431
2019-12-18 21:51:34 -08:00
kinarob
7fe113fea8 Remove useless system version code (#1396)
Summary:
## Changes in this pull request

`Examples/Examples-iOS/Pods/Pods.xcodeproj/project.pbxproj`
`Examples/Examples-tvOS/Pods/Pods.xcodeproj/project.pbxproj`

this change just Xcode 11.2 generated.

This pr aim to remove useless `IGSystemVersion` file.

### Checklist

- [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)
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1396

Reviewed By: lorixx

Differential Revision: D18638299

Pulled By: iperry90

fbshipit-source-id: 0b6583f1210e5d1570dd672eed8c59901d6785f6
2019-11-21 09:56:43 -08:00
Zhisheng Huang
f3175ec31f Update the version to be 4.0
Summary:
As title, let's prepare the 4.0 release with the version bump.

1. Change the Source/Info.plist to have 4.0.0 for CFBundleShortVersionString.
2. Manually update any .md files that used the old release versions.
3. Run `./scripts/setup.sh` to re-update all the pods and the Example projects.

Reviewed By: natestedman

Differential Revision: D18616823

fbshipit-source-id: ca0f2a09cdd9ab592c2cb002fe923e195ce3ab12
2019-11-20 16:23:15 -08:00
Zhisheng Huang
52f6a5e835 Fix WorkingRange example
Summary:
Before:

https://unsplash.it/300.0/200 failed

After:

https://unsplash.it/300/200 successed

= Facebook =
https://pxl.cl/Rp9f

Reviewed By: iperry90

Differential Revision: D18620012

fbshipit-source-id: dd206b9cdef93c279d7d2d8042c9ccfc242802fc
2019-11-20 11:35:26 -08:00
Koen Punt
97c0ec8e73 use cocoapods cdn (#1386)
Summary:
## Changes in this pull request

This updates the Podfile to use the specs CDN instead of the git checkout, which is more performant (and the default with CocoaPods 1.8 and higher).

### Checklist

- [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.
- [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/1386

Reviewed By: lorixx

Differential Revision: D18572204

Pulled By: iperry90

fbshipit-source-id: d3b721aaff92b18efeef31282cb9204055baec21
2019-11-20 09:24:48 -08:00
Nate Stedman
f367b455a6 Properly split IGListDiffKit and IGListKit podspecs (#1385)
Summary:
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1385

I attempted to work the two frameworks into a single podspec, but it didn't really work that well. Instead, let's just split them into two podspec files - this should work fine, and more closely follows the Carthage/Xcode behavior.

This should address #1382. Note that the attached project does need to be edited, because we also need to manually specify the `IGListDiffKit` pod location. This issue will go away with the release of 4.0.

Reviewed By: iperry90

Differential Revision: D18449843

fbshipit-source-id: 2750aee1ba39d21b9f1b3521ea8911929ae728b1
2019-11-13 05:30:28 -08:00
Nate Stedman
e4c60650f2 Split IGListKit and IGListDiffKit (#1377)
Summary:
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1377

This splits the diffing-only components from `IGListKit` out into a separate library, `IGListDiffKit`, allowing them to be used independently of the rest of `IGListKit`. We've found that the diffing components of the library are useful independently of the rest of the `UICollectionView` infrastructure, and separating the libraries allows apps to take advantage of those components without paying the full binary size cost of `IGListKit`. The diffing components are available as a subspec in Cocoapods, and as an independent framework in Carthage and direct Xcode project import (i.e. Git submodules).

This is a breaking change, necessitating a major version bump, although it should have only minor impact for projects using the umbrella header `IGListKit.h`, as that header continues to import the diffing utilities. In particular, for a project using Cocoapods and importing `IGListKit.h`, there should be no code changes required.

Reviewed By: calimarkus

Differential Revision: D18114249

fbshipit-source-id: 363b5a427e32800bbc6e82f897230963b4167245
2019-10-31 08:26:12 -07:00
Jeremy Lawrence
0ec9f8fff8 Remove references to removed files in pbxproj files (#1376)
Summary:
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1376

Our [builds](https://travis-ci.org/Instagram/IGListKit) have been failing since `IGListStackedSectionController` was removed in [D17200801](D17200801)/[1355](https://github.com/Instagram/IGListKit/pull/1355). The error message in our Travis logs points to something related to `IGListStackedSectionController` causing the error:

```
X  error: /Users/travis/build/Instagram/IGListKit/Source/Internal/IGListStackedSectionControllerInternal.h: No such file or directory

** BUILD FAILED **

The following build commands failed:
	CpHeader /Users/travis/build/Instagram/IGListKit/Source/Internal/IGListStackedSectionControllerInternal.h /Users/travis/Library/Developer/Xcode/DerivedData/IGListKitExamples-cfbxdbnpimeeplcoaiqrlyrrqjxn/Build/Products/Debug-iphonesimulator/IGListKit/IGListKit.framework/PrivateHeaders/IGListStackedSectionControllerInternal.h
(1 failure)
```

Pretty sure the issue here is that the `xcodeproj` files were not rebuilt after deleting these files, which meant they were pointing to files that no longer existed, which caused the build to fail. I was able to fix this issue by running our `setup.sh` script, which regenerated the `xcodeproj` files.

Reviewed By: bdotdub

Differential Revision: D18064465

fbshipit-source-id: d07586a99d4bbb9346bdda0752dbd613eb1b6d03
2019-10-23 11:31:09 -07:00
Hanton Yang
b01010e5e9 Deprecate IGListStackedSectionController (#1355)
Summary:
## Changes in this pull request

Issue fixed: https://github.com/Instagram/IGListKit/issues/1099

### 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/1355

Reviewed By: Ziewvater

Differential Revision: D17200801

Pulled By: lorixx

fbshipit-source-id: 22bb1abc69b38c9d856621fe848c09e61a9d41ef
2019-09-16 12:28:01 -07:00
Benny Wong
831e9b8809 Fix travis & upgrade cocoapods (#1317)
Summary:
This is a bigger PR than I'd like but there is a bunch of stuff in here that feels like we should land all at once to fix the Travis setup.

Currently, there is a few things wrong. Briefly:
1. Travis is failing to even build the library (see: [build 2298](https://travis-ci.org/Instagram/IGListKit/jobs/506564900))
2. There are legitimately failing tests
3. Travis seems to be flakey running UI tests

This PR deals with the first two.

The Xcode projects were not building because some recently added files weren't added to the xcodeproj (ie. 46a124ddfe and 4662454c4a).

Also added `Foundation.h` import for `bool` definition for `IGSystemVersion` (also a new file)

The main `Podfile.lock` was already being generated via `1.5.3` (0c0b31ad7c) but the `Gemfile` had the wrong version and none of the example project `Podfile.lock`s were re-generated with it.

Once I got the projects correctly building and tests running, I discovered there were a bunch of tests that were legitimately failing. It's unclear when these started failing and what caused it.

I thought it made sense to disable these tests for now and then create Github issues to fix them as starter tasks instead of making this diff even larger.. I can create those if that sounds good.

Somewhat related, it seems like the UI tests on Travis may be a bit flakey. They pass locally, but breaks on Travis [[example](https://travis-ci.com/bdotdub/IGListKit/jobs/195758250)] with error messages like `Failure requesting automation session for com.instagram.IGListKitExamples:85190`

----

- [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/1317

Reviewed By: rnystrom

Differential Revision: D15157375

Pulled By: rnystrom

fbshipit-source-id: b29131f59b74398b6d2b3a73453248cb3325a955
2019-05-01 15:13:25 -07:00
Hanton Yang
f743df8a0e Fix SwiftLint warnings (#1283)
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
2018-11-28 11:05:14 -08:00
Ryan Nystrom
8d8a632b67 Update MIT license language (#1272)
Summary:
Updating license language to meet FB open source standards.
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1272

Differential Revision: D12844366

Pulled By: rnystrom

fbshipit-source-id: 27ae49ae00d963c5c012c79c5738365c232a5773
2018-11-01 10:58:46 -07:00
Jesse Squires
0c0b31ad7c Run setup script with CocoaPods 1.5.3 (#1216)
Summary:
- Run setup script with CP 1.5.3
- Update to Xcode9.4 recommended settings
- Fix Xcode warnings about NSUInteger

This way we can avoid these changes on other open PRs/diffs.
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1216

Differential Revision: D8990061

Pulled By: rnystrom

fbshipit-source-id: ae15a267d7e6f19f71203ac4cd7d80ee966ee48b
2018-07-25 06:47:35 -07:00
Bofei Zhu
6c64c54a32 Remove optional (#1186)
Summary:
Issue fixed: #859

- [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/1186

Differential Revision: D8264918

Pulled By: rnystrom

fbshipit-source-id: 9f32c085f305299efd839bb365a5d32109ff4f17
2018-06-26 07:02:42 -07:00
Tim Oliver
0796e92a09 Fix warnings in macOS sample app in Xcode 9.3
Summary:
Issue fixed: #1057

- [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)

Hello again everyone! I was having a play with integrating Realm with IGListKit again and I noticed this issue detailing the macOS app featuring several build warnings.

This PR:
* Updates the settings of both the macOS example project, and the Pods project to the Xcode 9.3 defaults.
* Removes any deprecated Swift APIs.
* Updates some variable names to satisfy swiftlint's constraint that names should be >= 4 characters.

Please let me know if I need to change/add anything else. Thanks! :)
Closes https://github.com/Instagram/IGListKit/pull/1177

Differential Revision: D8204500

Pulled By: rnystrom

fbshipit-source-id: 141360acc08b179d698afa23b1d02aacca8a7434
2018-05-30 18:18:03 -07:00
Adam Stern
b4c8ea180f give section controllers access to collection view scrolling traits
Summary:
I'd like to be able to access the current collection view scrolling traits inside section controllers. These are expressed as three properties from `UIScrollView`:

`isTracking`, `isDragging`, and `isDecelerating`.

My approach is to add a new struct `IGListCollectionScrollingTraits` with these three values, and expose this to section controllers through `IGListCollectionContext`.

Reviewed By: rnystrom

Differential Revision: D7986814

fbshipit-source-id: 19e9bd3b89545b10238dd060a5af8c5a0f39eb82
2018-05-14 14:56:54 -07:00
Ryan Nystrom
cce5a462bb Update examples for 3.4
Summary:
See title
Closes https://github.com/Instagram/IGListKit/pull/1166

Differential Revision: D7860384

Pulled By: rnystrom

fbshipit-source-id: 3536f8434cb28591be23cb9456b5613f7a1a1a07
2018-05-03 10:29:18 -07:00
Ryan Nystrom
6771b4146f Update examples for 3.3.0
Summary:
Ran examples pod scripts to update example projects.
Closes https://github.com/Instagram/IGListKit/pull/1152

Differential Revision: D7709652

Pulled By: rnystrom

fbshipit-source-id: 7a267fabbf6535d15e53d19d7211f6159e66a8f0
2018-04-20 11:18:50 -07:00
Sho Ikeda
9315299fbc Minimum fixes for Xcode 9.3 build errors
Summary:
Issue fixed: #1141

This is a set of minimum fixes for Xcode 9.3 rather than #1142. Much smaller diffs 😃

The changes here were done by Xcode's FixIt. See also https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265-SW5.

> Platform Dependencies
>
> OS X uses several data types—NSInteger, NSUInteger,CGFloat, and CFIndex—to provide a consistent means of representing values in 32- and 64-bit environments. In a 32-bit environment, NSInteger and NSUInteger are defined as int and unsigned int, respectively. In 64-bit environments, NSInteger and NSUInteger are defined as long and unsigned long, respectively. To avoid the need to use different printf-style type specifiers depending on the platform, you can use the specifiers shown in Table 3. Note that in some cases you may have to cast the value.

- [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/1143

Differential Revision: D7551617

Pulled By: rnystrom

fbshipit-source-id: b27ebe2b1a1c93ebfd1218dc38b7621fefee2e6b
2018-04-09 08:37:18 -07:00
Jared Verdi
f15b167e85 Interactive Reordering
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
2018-02-12 09:27:08 -08:00
Markus Emrich
e02dd0e7ed Add IGListDiffable remodel plugin source + documentation (a new guide)
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
2018-02-09 10:18:18 -08:00
Ryan Nystrom
96445ef2a0 Update podspec, project, and examples to 3.2
Summary: Closes https://github.com/Instagram/IGListKit/pull/1087

Differential Revision: D6917772

Pulled By: rnystrom

fbshipit-source-id: a1e965c58d6da6ef5b32a3bc3c2f23f37fc64794
2018-02-06 15:47:20 -08:00
Ryan Nystrom
37c798ac78 Bump min macOS version to 10.11 #trivial
Summary:
Followup from #1068

The `NSIndexPath` methods we use **are not** available <10.11. In theory this has always been "broken" b/c older macOS versions would crash at runtime when trying to use these methods.

Normally this would be breaking change, but I can't imagine anyone is using IGListKit on the mac targeting 10.10 and shipping a working app.

cc jessesquires for thoughts

This should be the last remaining item before we get a green badge.

(note that 10.11 was released 9/30/15 which is about 2 weeks before the public IGListKit release)
Closes https://github.com/Instagram/IGListKit/pull/1080

Differential Revision: D6894369

Pulled By: rnystrom

fbshipit-source-id: e5992c7bba68b21704af6bc8fb889b5427266954
2018-02-03 08:31:28 -08:00
Jesse Squires
95b779a584 Update .travis.yml and lint.sh, try to fix #1060 and lint errors #trivial
Summary:
project:
- fix file target membership issues in framework targets and test targets
- fix private/internal header imports, which shouldn't be `<IGListKit/` apparently
- fix static analyzer errors

travis:
- always install latest swiftlint
- ~~don't cache bundler, attempts to fix #1060~~
- remove markdown link check

swiftlint:
- make script non-failing if *any* version of swiftlint is installed
- warning if incorrect version is installed
- fail if not installed
- remove `scripts/generate_ci_yaml.rb`, we can just set the config file path directly
Closes https://github.com/Instagram/IGListKit/pull/1068

Differential Revision: D6885575

Pulled By: rnystrom

fbshipit-source-id: 51b7baa73feefcea71d870c1220d0382df484199
2018-02-02 13:16:46 -08:00