2016-09-07 22:37:59 +00:00
< p align = "center" >
2023-02-09 02:34:25 +00:00
< img src = "https://raw.githubusercontent.com/Instagram/IGListKit/main/Resources/logo-animation.gif" width = 400 / >
2016-09-07 22:37:59 +00:00
< / p >
2016-10-27 17:09:43 +00:00
< p align = "center" >
2023-02-09 05:18:16 +00:00
< a href = "https://github.com/Instagram/IGListKit/actions/workflows/CI.yml" >
< img src = "https://img.shields.io/github/actions/workflow/status/Instagram/IGListKit/CI.yml"
2016-10-27 17:09:43 +00:00
alt="Build Status">
< / a >
2023-02-09 02:34:25 +00:00
< a href = "https://coveralls.io/github/Instagram/IGListKit?branch=main" >
< img src = "https://coveralls.io/repos/github/Instagram/IGListKit/badge.svg?branch=main"
2016-11-21 17:53:23 +00:00
alt="Coverage Status" />
2016-10-27 17:09:43 +00:00
< / a >
< a href = "https://cocoapods.org/pods/IGListKit" >
< img src = "https://img.shields.io/cocoapods/v/IGListKit.svg?style=flat"
alt="Pods Version">
< / a >
2016-12-12 19:11:19 +00:00
< a href = "https://instagram.github.io/IGListKit/" >
< img src = "https://img.shields.io/cocoapods/p/IGListKit.svg?style=flat"
alt="Platforms">
< / a >
2016-10-27 17:09:43 +00:00
< a href = "https://github.com/Carthage/Carthage" >
< img src = "https://img.shields.io/badge/Carthage-compatible-brightgreen.svg?style=flat"
alt="Carthage Compatible">
< / a >
< / p >
2016-09-07 22:37:59 +00:00
2016-10-27 17:09:43 +00:00
----------------
2016-09-07 22:37:59 +00:00
A data-driven `UICollectionView` framework for building fast and flexible lists.
2016-11-23 20:42:52 +00:00
| | Main Features |
----------|-----------------
2016-10-11 18:38:22 +00:00
🙅 | Never call `performBatchUpdates(_:, completion:)` or `reloadData()` again
🏠 | Better architecture with reusable cells and components
🔠 | Create collections with multiple data types
🔑 | Decoupled diffing algorithm
2016-11-23 20:42:52 +00:00
✅ | Fully unit tested
2016-10-11 18:38:22 +00:00
🔍 | Customize your diffing behavior for your models
📱 | Simply `UICollectionView` at its core
🚀 | Extendable API
🐦 | Written in Objective-C with full Swift interop support
2016-09-07 22:37:59 +00:00
2016-12-14 17:30:09 +00:00
`IGListKit` is built and maintained with ❤️ by [Instagram engineering ](https://engineering.instagram.com/ ).
2023-02-09 02:34:25 +00:00
We use the open source version `main` branch in the Instagram app.
2016-09-07 22:37:59 +00:00
2020-09-29 17:37:24 +00:00
## Multilingual translation
[Chinese README ](README.zh.md )
2016-10-25 16:58:18 +00:00
## Requirements
2018-01-22 02:24:47 +00:00
- Xcode 9.0+
2019-11-21 00:20:23 +00:00
- iOS 9.0+
2016-10-29 21:39:18 +00:00
- tvOS 9.0+
2018-02-07 00:33:42 +00:00
- macOS 10.11+ *(diffing algorithm components only)*
2016-10-25 16:58:18 +00:00
- Interoperability with Swift 3.0+
2016-09-07 22:37:59 +00:00
## Installation
2016-10-12 18:09:34 +00:00
### CocoaPods
2016-10-25 16:58:18 +00:00
2016-12-27 20:37:57 +00:00
The preferred installation method is with [CocoaPods ](https://cocoapods.org ). Add the following to your `Podfile` :
2016-09-07 22:37:59 +00:00
```ruby
2019-11-21 00:20:23 +00:00
pod 'IGListKit', '~> 4.0.0'
2016-09-07 22:37:59 +00:00
```
2016-10-12 00:39:37 +00:00
### Carthage
2016-12-27 20:37:57 +00:00
For [Carthage ](https://github.com/Carthage/Carthage ), add the following to your `Cartfile` :
2016-10-12 00:39:37 +00:00
```ogdl
2019-11-21 00:20:23 +00:00
github "Instagram/IGListKit" ~> 4.0.0
2016-10-12 00:39:37 +00:00
```
2021-10-13 23:09:32 +00:00
### Swift Package Manager
For [Swift Package Manager ](https://swift.org/package-manager/ ):
```
To integrate using Xcode:
File -> Swift Packages -> Add Package Dependency
Enter package URL: https://github.com/Instagram/IGListKit, and select the latest release.
```
2016-12-27 20:37:57 +00:00
> For advanced usage, see our [Installation Guide](https://instagram.github.io/IGListKit/installation.html).
2016-11-23 20:42:52 +00:00
## Getting Started
2016-09-07 22:37:59 +00:00
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-07 07:29:41 +00:00
Try out IGListKit by opening any of the sample apps available in the `Examples ` directory.
2018-01-22 02:24:47 +00:00
2016-12-12 22:29:29 +00:00
- Our [Getting Started guide ](https://instagram.github.io/IGListKit/getting-started.html )
- Ray Wenderlich's [IGListKit Tutorial: Better UICollectionViews ](https://www.raywenderlich.com/147162/iglistkit-tutorial-better-uicollectionviews )
2023-02-09 02:34:25 +00:00
- Our [example projects ](https://github.com/Instagram/IGListKit/tree/main/Examples )
2020-08-05 17:20:17 +00:00
- Ryan Nystrom's [talk at try! Swift NYC ](https://academy.realm.io/posts/tryswift-ryan-nystrom-refactoring-at-scale-lessons-learned-rewriting-instagram-feed/ )(Note: this talk was for an earlier version. Some APIs have changed.)
2017-04-12 21:48:25 +00:00
- [Migrating an UITableView to IGListCollectionView ](https://medium.com/cocoaacademymag/iglistkit-migrating-an-uitableview-to-iglistkitcollectionview-65a30cf9bac9 ), by Rodrigo Cavalcante
- [Keeping data fresh in Buffer for iOS with AsyncDisplayKit, IGListKit & Pusher ](https://overflow.buffer.com/2017/04/10/keeping-data-fresh-buffer-ios-asyncdisplaykit-iglistkit-pusher/ ), Andy Yates, Buffer
2016-09-07 22:37:59 +00:00
## Documentation
You can find [the docs here ](https://instagram.github.io/IGListKit ). Documentation is generated with [jazzy ](https://github.com/realm/jazzy ) and hosted on [GitHub-Pages ](https://pages.github.com ).
2017-06-01 03:51:02 +00:00
To regenerate docs, run `./scripts/build_docs.sh` from the root directory in the repo.
2017-04-07 22:21:40 +00:00
## Vision
2023-02-09 02:34:25 +00:00
For the long-term goals and "vision" of `IGListKit` , please read our [Vision ](https://github.com/Instagram/IGListKit/blob/main/Guides/VISION.md ) doc.
2017-04-07 22:21:40 +00:00
2016-09-07 22:37:59 +00:00
## Contributing
2023-02-09 02:34:25 +00:00
Please see the [CONTRIBUTING ](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md ) file for how to help. At Instagram, we sync the open source version of `IGListKit` daily, so we're always testing the latest changes. But that requires all changes be thoroughly tested and follow our style guide.
2016-09-07 22:37:59 +00:00
2017-06-01 03:51:02 +00:00
We have a set of [starter tasks ](https://github.com/Instagram/IGListKit/issues?q=is%3Aissue+is%3Aopen+label%3Astarter-task ) that are great for beginners to jump in on and start contributing.
2017-05-22 15:54:55 +00:00
2016-09-07 22:37:59 +00:00
## License
2021-02-02 17:08:10 +00:00
`IGListKit` is [MIT-licensed ](./LICENSE.md ).
2016-09-07 22:37:59 +00:00
2016-12-12 15:11:19 +00:00
The files in the `/Examples/` directory are licensed under a separate license as specified in each file. Documentation is licensed [CC-BY-4.0 ](https://creativecommons.org/licenses/by/4.0/ ).
2023-04-06 09:44:16 +00:00
## Legal
2023-04-07 08:58:02 +00:00
Copyright © Meta Platforms, Inc • < a href = "https://opensource.fb.com/legal/terms" > Terms of Use< / a > • < a href = "https://opensource.fb.com/legal/privacy" > Privacy Policy< / a >