DiffableDataSources alternatives and similar libraries
Based on the "UITableView" category.
Alternatively, view DiffableDataSources alternatives based on common mentions on social networks and blogs.
-
folding-cell
:octocat: 📃 FoldingCell is an expanding content cell with animation made by @Ramotion -
SwipeCellKit
Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift. -
DGElasticPullToRefresh
Elastic pull to refresh for iOS developed in Swift -
Persei
Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift -
HGPlaceholders
Nice library to show placeholders and Empty States for any UITableView/UICollectionView in your project -
ReverseExtension
A UITableView extension that enables cell insertion from the bottom of a table view. -
ExpandableCell
✨ Awesome expandable, collapsible tableview cell for iOS written in Swift 5 -
GridView
Reusable GridView with excellent performance and customization that can be time table, spreadsheet, paging and more. -
PullToRefreshSwift
iOS Simple Cool PullToRefresh Library. It is written in pure swift. -
KJCategories
Collection of native ios extensions and classes to boost development process. Such as UIKit, Foundation, QuartzCore, Accelerate, OpenCV, CoreGraphics, os and more. 超实用开发加速工具收集 -
QuickTableViewController
A simple way to create a UITableView for settings in Swift. -
YNExpandableCell
✨ Awesome expandable, collapsible tableview cell for iOS written in Swift 4 -
CollapsibleTableSectionViewController
:tada: Swift library to support collapsible sections in a table view. -
ExpyTableView
Make your table view expandable just by implementing one method. -
WLEmptyState
WLEmptyState is an iOS based component that lets you customize the view when the dataset of a UITableView or a UICollectionView is empty. We created a sample project with the WLEmptyState component to show how you can use it. -
SwiftyComments
UITableView based component designed to display a hierarchy of expandable/foldable comments. -
AEAccordion
Simple and lightweight UITableViewController with accordion effect (expand / collapse cells) -
SectionScrubber
A component to quickly scroll between collection view sections -
SelectionList
Simple single-selection or multiple-selection checklist, based on UITableView -
SPDiffable
Extension of Diffable API which allow not duplicate code and use less models. Included example for SideBar. -
AZTableViewController
Elegant and easy way to integrate pagination with dummy views -
OKTableViewLiaison
Framework to help you better manage UITableViews -
CollapsibleTable
Collapsable table view sections with custom section header views. -
FDTextFieldTableViewCell
A UITableViewCell with an editable text field -
Doppelganger-Swift
Array diffs as collection view wants it - now in Swift ✨ -
CKTextFieldTableCell
UITableViewCell drop-in replacement with support of UITextField
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of DiffableDataSources or a related project?
README
DiffableDataSources 💾 A library for backporting UITableView/UICollectionViewDiffableDataSource powered by DifferenceKit.
Made with ❤️ by Ryo Aoyama
Introduction
Apple has announced a diffable data source at WWDC 2019.
It's a great API that easily updating our table view and collection view items using automatic diffing.
However, it's a little while before we can use it in a production service.
That because it requires the latest OS to use.
DiffableDataSources make it possible to introduce almost the same functionality from now on.
Uses a sophisticated open source DifferenceKit for the algorithm engine.
It's extremely fast and completely avoids synchronization bugs, exceptions, and crashes.
Difference from the Official
Spec
- Supports iOS 9.0+ / macOS 10.11+ / tvOS 9.0+
- Open sourced algorithm.
- Duplicate sections or items are allowed.
- Using
performBatchUpdates
for diffing updates.
Namings
DiffableDataSources
have different class names to avoid conflicts with the official API.
Correspondence table is below.
Official | Backported |
---|---|
NSDiffableDataSourceSnapshot | DiffableDataSourceSnapshot |
UITableViewDiffableDataSource | TableViewDiffableDataSource |
UICollectionViewDiffableDataSource | CollectionViewDiffableDataSource |
NSCollectionViewDiffableDataSource | CocoaCollectionViewDiffableDataSource |
Getting Started
Build Project
$ git clone https://github.com/ra1028/DiffableDataSources.git
$ cd DiffableDataSources/
$ make setup
$ open DiffableDataSources.xcworkspace
Basic Usage
First, define the type representing section.
It should conforms to Hashable
for identifies from the all sections.
Type of enum can used conveniently because it conforms Hashable
by default.
enum Section {
case main
}
Then, define the item type conforms to Hashable
.
struct User: Hashable {
var name: String
}
Create a data source object, it will be set to table view automatically.
You should dequeue the non nil cells via closure.
final class UsersViewController: UIViewController {
let tableView: UITableView = ...
lazy var dataSource = TableViewDiffableDataSource<Section, User>(tableView: tableView) { tableView, indexPath, user in
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
cell.textLabel?.text = user.name
return cell
}
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell")
}
}
Manages and updates the data sources intuitively by intermediating DiffableDataSourceSnapshot
.
The UI isn't updated until you apply the edited snapshot object.
Update the UI with diffing animation automatically calculated by applying an edited snapshot.
let users = [
User(name: "Steve Jobs"),
User(name: "Stephen Wozniak"),
User(name: "Tim Cook"),
User(name: "Jonathan Ive")
]
let snapshot = DiffableDataSourceSnapshot<Section, User>()
snapshot.appendSections([.main])
snapshot.appendItems(users)
dataSource.apply(snapshot) {
// completion
}
Check the documentation for more detailed API.
[See More Usage]
Requirements
- Swift 5.0+
- iOS 9.0+
- macOS 10.11+
- tvOS 9.0+
Installation
CocoaPods
Add the following to your Podfile
:
pod 'DiffableDataSources'
Carthage
Add the following to your Cartfile
:
github "ra1028/DiffableDataSources"
Swift Package Manager
Add the following to the dependencies of your Package.swift
:
.package(url: "https://github.com/ra1028/DiffableDataSources.git", from: "x.x.x")
Contributing
Pull requests, bug reports and feature requests are welcome 🚀
Please see the CONTRIBUTING file for learn how to contribute to DiffableDataSources.
Relations
DifferenceKit
A fast and flexible O(n) difference algorithm framework for Swift collection.
Carbon
A declarative library for building component-based user interfaces in UITableView and UICollectionView.
License
DiffableDataSources is released under the Apache 2.0 License.
*Note that all licence references and agreements mentioned in the DiffableDataSources README section above
are relevant to that project's source code only.