Commit graph

32 commits

Author SHA1 Message Date
Jesse Squires
ae7f36f5c2 Update gems, fix warnings, pod install
Summary:
- Update CocoaPods + Gems
- Update SwiftLint version
- Fix lint errors
- Fix `pod_setup.sh` script, move to `scripts/` (should now be run from root dir)
- Run `pod_setup.sh`
Closes https://github.com/Instagram/IGListKit/pull/1038

Differential Revision: D6602297

Pulled By: rnystrom

fbshipit-source-id: 1bf69611e041903cf982fe7d9a95197729e44d94
2017-12-19 09:31:37 -08:00
yiplee
e63a0e78fe Add new iOS 11 api adjustedContentInset support
Summary:
adopt adjustedContentInset instead of contentInset on iOS 11

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

Reviewed By: manicakes

Differential Revision: D6513703

Pulled By: rnystrom

fbshipit-source-id: 5d718f2cb30361959ca5ba8238746427223cb5fd
2017-12-18 08:51:14 -08:00
Maxime Ollivier
74c5fb3566 Update pods and examples
Summary:
Update pod and examples so project builds when synced

Depends on D6545334

Reviewed By: rnystrom

Differential Revision: D6573821

fbshipit-source-id: b0d4246fa9c0d627ebcd34ac7abd5c8453964037
2017-12-15 09:33:39 -08:00
Ryan Nystrom
48aff22218 Update examples pods so they build #trivial
Summary:
Fixes examples failing to build after #916. I should have looked at Travis closer, my bad!

- [x] All tests pass. Demo project builds and runs.
Closes https://github.com/Instagram/IGListKit/pull/946

Differential Revision: D6008573

Pulled By: rnystrom

fbshipit-source-id: 727da8f8e8d1079c7840aa9db1152477bf1058ee
2017-10-09 06:45:45 -07:00
Ryan Nystrom
f7220b5cfe Update example project files, convert to Swift 4, and fix errors
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
2017-09-22 06:55:23 -07:00
Ryan Nystrom
0ad49e16f0 Pod install 3.1.0
Summary:
Updating example pods via script
Closes https://github.com/Instagram/IGListKit/pull/911

Differential Revision: D5695840

Pulled By: rnystrom

fbshipit-source-id: 7aaaf9f07e0aa0cccbebbcbd12d9e5a617755cf1
2017-08-23 19:32:17 -07:00
Ryan Nystrom
f743b1c915 Regen example project files
Summary:
Regen example projects w/ pod script file.

Part of #707

Reviewed By: jessesquires

Differential Revision: D5039135

fbshipit-source-id: d29bcf635aea59aa589bd90644fb1ece6279cc10
2017-05-10 14:01:05 -07:00
Robert Payne
40625f8ff9 Swift name annotations
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
2017-05-09 14:31:28 -07:00
Andrew Monshizadeh
a4e5ad862e Move section index to property
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
2017-05-01 07:28:27 -07:00
Ryan Nystrom
f1ebfbdb7d Disable iOS 9.3 tests
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
2017-04-27 14:47:43 -07:00
Ryan Nystrom
073fc073e0 Prevent duplicate item deletes and drop reload collisions
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
2017-04-19 17:17:41 -07:00
Ryan Nystrom
301f1471c9 Add generic type section controller
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
2017-04-19 12:45:36 -07:00
Ryan Nystrom
3102852ce2 Remove IGListSectionType
Summary:
Removing the `IGListSectionType` protocol and adding default implementations into `IGListSectionController`.

- `numberOfItems` returns 1
- `cellForItemAtIndex:` asserts (have to return a cell)
- `didUpdateToObject:` no-ops
- `didSelectItemAtIndex:` no-ops

Fixes #168

Reviewed By: jessesquires

Differential Revision: D4909585

fbshipit-source-id: 8816702504e3fc0683868914ff4dd20e4af7c166
2017-04-19 08:26:30 -07:00
Andrew Monshizadeh
ae11d6af53 Move UICollectionView(DataSource|Delegate) to category
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
2017-04-18 11:21:18 -07:00
Jesse Squires
2284ce3897 kill IGListCollectionView. GH issue #409 (redo of D4640425)
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
2017-03-31 14:54:09 -07:00
Ryan Nystrom
a15ea08614 Move section controller mutation API to object provided in update block
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
2017-03-22 12:46:49 -07:00
Nikolai Johan Heum
353d90f397 fixed broken example project
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
2017-03-20 14:48:14 -07:00
Ryan Nystrom
79348164a7 Auto diffing section controller
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
2017-03-15 07:47:24 -07:00
Ryan Nystrom
139507325c Fix examples
Summary:
Broke in #525 b/c didn't run `pod_install.sh` after adding new files.

Issue fixed: #537
Closes https://github.com/Instagram/IGListKit/pull/538

Differential Revision: D4695675

Pulled By: rnystrom

fbshipit-source-id: 3edc6e25f545efdc5475035036e25bb0e1b304d3
2017-03-11 13:31:28 -08:00
Leyla Hujer
68a264d29c Revert D4640425: [IGListKit] kill IGListCollectionView. GH issue #409
Summary: This reverts commit 871b75eaeb1c9f2a40fe8f3fd81b209661704587

Differential Revision: D4640425

fbshipit-source-id: 4b0e8a9820891062cf7f8d13de13d678adb5df4a
2017-03-06 16:15:31 -08:00
Jesse Squires
3fb2ac0d60 kill IGListCollectionView. GH issue #409
Summary: Remove `IGListCollectionView` per #409. Use plain old `UICollectionView`.

Reviewed By: rnystrom

Differential Revision: D4640425

fbshipit-source-id: 871b75eaeb1c9f2a40fe8f3fd81b209661704587
2017-03-06 15:01:01 -08:00
Ryan Nystrom
a5a08d2e11 Remove IGListGridCollectionViewLayout
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
2017-02-13 14:30:58 -08:00
Ryan Nystrom
e2c2d3dcec Vertical UICollectionViewLayout supporting inline sections (take 2)
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
2017-02-10 18:01:22 -08:00
Ryan Nystrom
80ad941369 Revert D4521797: [IGListKit][PR] Vertical UICollectionViewLayout supporting inline sections
Summary: This reverts commit 20b36ae573d38ca3125a6f3d5faec181c290ab94

Differential Revision: D4521797

fbshipit-source-id: 447de6cf2b30de9c2109dffb266326aceceec7fc
2017-02-10 11:33:07 -08:00
Ryan Nystrom
727833409f Vertical UICollectionViewLayout supporting inline sections
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
2017-02-10 08:30:33 -08:00
James Sherlock
5cd771b546 Added Subspec for Diffing
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
2016-12-27 12:44:27 -08:00
Sherlock
19d4f9d1f7 Added compatibility header
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
2016-12-24 10:44:25 -08:00
Jesse Squires
4e42712e5b fixup common files and podspec, #270
Summary:
- Add missing common files
- Fix podspec for common files
- Pod install all examples

Reviewed By: rnystrom

Differential Revision: D4350871

fbshipit-source-id: 708ebe6ce66caed75af5b2ac18920dcf45567d16
2016-12-19 21:44:13 -08:00
Ryan Nystrom
ad30e53507 Move macOS and diffing files to Common dir
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
2016-12-19 12:29:24 -08:00
Ryan Nystrom
316fbe2b8b Remove NSObject+IGListDiffable category
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
2016-11-21 16:59:00 -08:00
Bofei Zhu
1d3e58b9fd Create a grid layout for IGList
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
2016-11-21 13:29:04 -08:00
Jesse Squires
879260b417 internal diff for PR #209
Summary: https://github.com/Instagram/IGListKit/pull/209

Reviewed By: rnystrom

Differential Revision: D4190633

fbshipit-source-id: 9d382b9ba3f3d20c8b9c48d900650ec354bc9728
2016-11-16 12:44:19 -08:00