IGListKit/README.md

127 lines
5.3 KiB
Markdown
Raw Normal View History

<p align="center">
<img src="https://raw.githubusercontent.com/Instagram/IGListKit/main/Resources/logo-animation.gif" width=400 />
</p>
<p align="center">
<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"
alt="Build Status">
</a>
<a href="https://coveralls.io/github/Instagram/IGListKit?branch=main">
<img src="https://coveralls.io/repos/github/Instagram/IGListKit/badge.svg?branch=main"
alt="Coverage Status" />
</a>
<a href="https://cocoapods.org/pods/IGListKit">
<img src="https://img.shields.io/cocoapods/v/IGListKit.svg?style=flat"
alt="Pods Version">
</a>
<a href="https://instagram.github.io/IGListKit/">
<img src="https://img.shields.io/cocoapods/p/IGListKit.svg?style=flat"
alt="Platforms">
</a>
<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>
----------------
A data-driven `UICollectionView` framework for building fast and flexible lists.
| | Main Features |
----------|-----------------
&#128581; | Never call `performBatchUpdates(_:, completion:)` or `reloadData()` again
&#127968; | Better architecture with reusable cells and components
&#128288; | Create collections with multiple data types
&#128273; | Decoupled diffing algorithm
&#9989; | Fully unit tested
&#128269; | Customize your diffing behavior for your models
&#128241; | Simply `UICollectionView` at its core
&#128640; | Extendable API
&#128038; | Written in Objective-C with full Swift interop support
`IGListKit` is built and maintained with &#10084;&#65039; by [Instagram engineering](https://engineering.instagram.com/).
We use the open source version `main` branch in the Instagram app.
## Multilingual translation
[Chinese README](README.zh.md)
## Requirements
- Xcode 9.0+
- iOS 9.0+
- tvOS 9.0+
- macOS 10.11+ *(diffing algorithm components only)*
- Interoperability with Swift 3.0+
## Installation
### CocoaPods
The preferred installation method is with [CocoaPods](https://cocoapods.org). Add the following to your `Podfile`:
```ruby
pod 'IGListKit', '~> 4.0.0'
```
### Carthage
For [Carthage](https://github.com/Carthage/Carthage), add the following to your `Cartfile`:
```ogdl
github "Instagram/IGListKit" ~> 4.0.0
```
### 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.
```
> For advanced usage, see our [Installation Guide](https://instagram.github.io/IGListKit/installation.html).
## Getting Started
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.
- 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)
- Our [example projects](https://github.com/Instagram/IGListKit/tree/main/Examples)
- 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.)
- [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
## 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).
To regenerate docs, run `./scripts/build_docs.sh` from the root directory in the repo.
## Vision
For the long-term goals and "vision" of `IGListKit`, please read our [Vision](https://github.com/Instagram/IGListKit/blob/main/Guides/VISION.md) doc.
## Contributing
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.
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.
## License
The README file in this repo has a bad link - [404:NotFound] - “MIT-licensed” (#1489) Summary: The markup version of the readme that is displayed for the main page in this repo contains the following bad link: “MIT-licensed” https://github.com/Instagram/IGListKit/blob/master/LICENSE It should be: https://github.com/Instagram/IGListKit/blob/master/LICENSE.md **Extra** This bad link was found by a tool I recently created as part of an new experimental hobby project: https://github.com/MrCull/GitHub-Repo-ReadMe-Dead-Link-Finder Re-check this Repo via: http://githubreadmechecker.com/Home/Search?SingleRepoUri=https%3a%2f%2fgithub.com%2fInstagram%2fIGListKit If this has been helpful, or if you have any feedback on the tool itself, then please feel free to share your thoughts by adding a comment here, or adding to a “Discussion” in the tool’s Repo. ## Changes in this pull request Issue fixed: Did not log issue for trivial typo in readme. ### Checklist - [N/A] All tests pass. Demo project builds and runs. - [N/A] 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) Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1489 Reviewed By: bdotdub Differential Revision: D25872470 Pulled By: lorixx fbshipit-source-id: befe2359d1d2604ec872bf454893e10233f75ac5
2021-02-02 17:08:10 +00:00
`IGListKit` is [MIT-licensed](./LICENSE.md).
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/).
## Legal
Copyright © Meta Platforms, Inc &#x2022; <a href="https://opensource.fb.com/legal/terms">Terms of Use</a> &#x2022; <a href="https://opensource.fb.com/legal/privacy">Privacy Policy</a>