DataSources alternatives and similar libraries
Based on the "Table View / Collection View" category.
Alternatively, view DataSources alternatives based on common mentions on social networks and blogs.
-
IGListKit
A data-driven UICollectionView framework for building fast and flexible lists. -
SwipeCellKit
Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift. -
CHTCollectionViewWaterfallLayout
The waterfall (i.e., Pinterest-like) layout for UICollectionView. -
MCSwipeTableViewCell
π Convenient UITableViewCell subclass that implements a swippable content to trigger actions (similar to the Mailbox app). -
HGPlaceholders
Nice library to show placeholders and Empty States for any UITableView/UICollectionView in your project -
YBSlantedCollectionViewLayout
A CollectionView Layout displaying a slanted cells -
ReverseExtension
A UITableView extension that enables cell insertion from the bottom of a table view. -
TimelineTableViewCell
Simple timeline view implemented by UITableViewCell -
Bohr
Bohr allows you to set up a settings screen for your app with three principles in mind: ease, customization and extensibility. -
CenteredCollectionView
A lightweight UICollectionViewLayout that 'pages' and centers its cells π‘ written in Swift -
BATabBarController
A TabBarController with a unique animation for selection -
CascadingTableDelegate
A no-nonsense way to write cleaner UITableViewDelegate and UITableViewDataSource in Swift. -
ExpandableCell
β¨ Awesome expandable, collapsible tableview cell for iOS written in Swift 5 -
FMMosaicLayout
A drop-in mosaic collection view layout with a focus on simple customizations. -
GLTableCollectionView
Netflix and App Store like UITableView with UICollectionView, written in pure Swift 4.2 -
ListPlaceholder
ListPlaceholder is a swift library allows you to easily add facebook style animated loading placeholder to your tableviews or collection views. -
SwiftSpreadSheet
Spreadsheet CollectionViewLayout in Swift. Fully customizable. πΆ -
KDDragAndDropCollectionView
This component allows for the transfer of data items between collection views through drag and drop -
MYTableViewIndex
A pixel perfect replacement for UITableView section index, written in Swift -
TableFlip
A simpler way to do cool UITableView animations! (β―Β°β‘Β°οΌβ―οΈ΅ β»ββ» -
TableViewDragger
A cells of UITableView can be rearranged by drag and drop. -
DTTableViewManager
Protocol-oriented UITableView management, powered by generics and associated types. -
YNExpandableCell
β¨ Awesome expandable, collapsible tableview cell for iOS written in Swift 4 -
TLIndexPathTools
TLIndexPathTools is a small set of classes that can greatly simplify your table and collection views. -
CollapsibleTableSectionViewController
:tada: Swift library to support collapsible sections in a table view. -
TLLayoutTransitioning
Enhanced transitioning between UICollectionView layouts in iOS. -
ExpyTableView
Make your table view expandable just by implementing one method. -
RHPreviewCell
I envied so much Spotify iOS app this great playlist preview cell π, I decided to create my own one πΆ. Now you can give your users ability to quick check "what content is hidden under your UITableViewCell". Great think is that this Library not requires 3D Touch support from user deviceπ₯. -
PagingView
Infinite paging, Smart auto layout, Interface of similar to UIKit. -
ASCollectionView
Lightweight custom collection view inspired by Airbnb. -
TRMosaicLayout
A mosaic collection view layout inspired by Lightbox's Algorithm, written in Swift πΆ -
SquareMosaicLayout
An extandable mosaic UICollectionViewLayout with a focus on extremely flexible customizations :large_orange_diamond: -
SectionScrubber
A component to quickly scroll between collection view sections -
HoverConversion
HoverConversion realized vertical paging with UITableView. UIViewController will be paging when reaching top or bottom of UITableView contentOffset. -
TORoundedTableView
A subclass of UITableView that styles it like Settings.app on iPad -
GenericDataSource
A generic small reusable components for data source implementation for UITableView/UICollectionView in Swift. -
WheelPicker
Customizable wheel picker view implementation for iOS. -
PJFDataSource
PJFDataSource is a small library that provides a simple, clean architecture for your app to manage its data sources while providing a consistent user interface for common content states (i.e. loading, loaded, empty, and error). -
AZCollectionViewController
Easy way to integrate pagination with dummy views in CollectionView, make Instagram "Discover" within minutes. -
EditDistance
Incremental update tool to UITableView and UICollectionView -
AZTableViewController
Elegant and easy way to integrate pagination with dummy views -
ThreeLevelAccordian
Three Level Accordian View for IOS -
ios-dragable-table-cells
Objective-C library for drag-n-drop of UITableViewCells in a navigation hierarchy of view controllers.
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 DataSources or a related project?
README
DataSources
πΎ ππ± Type-safe data-driven List-UI Framework. (We can also use ASCollectionNode)
Partial updates(insert, delete, move) of UICollectionView/UITableView is important things for fancy UI. But, It's hard that synchronous of data and UI. DataSources will solve this problem.
[](sample.gif)
Thanks
Diff-algorithm
- Inspired by IGListKit/IGListDiff.
Features
- Data driven update
- Data did change, then will display.
- Partial updates, no more calling
reloadData
- Smooth and Faster.
- if the count of changes larger than 300, update with non-animation.
- Simplified usage
- We can use different type each section.
- Type-safe
- We can take clearly typed object by IndexPath.
- Using Adapter-pattern for List-UI
- For example, We can also use this for ASCollectionNode of Texture. (Demo app includes it)
- Reorder by UI operation
- This library is not supported moving between section.
Requirements
- Swift 4
- iOS 9+
Usage (Example)
Conform protocol Diffable
public protocol Diffable {
associatedtype Identifier : Hashable
var diffIdentifier: Identifier { get }
}
struct Model : Diffable {
var diffIdentifier: String {
return id
}
let id: String
}
π€ Most Simplified Usage
- Define
SectionDataController
in ViewController
let collectionView: UICollectionView
let sectionDataController = SectionDataController<Model, CollectionViewAdapter>(
adapter: CollectionViewAdapter(collectionView: self.collectionView),
isEqual: { $0.id == $1.id } // If Model has Equatable, you can omit this closure.
)
var models: [Model] = [] {
didSet {
sectionDataController.update(items: items, updateMode: .partial(animated: true), completion: {
// Completed update
})
}
}
let dataSource = CollectionViewDataSource(sectionDataController: sectionDataController)
dataSource.cellFactory = { _, collectionView, indexPath, model in
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! Cell
cell.label.text = model.title
return cell
}
collectionView.dataSource = dataSource
π Semi Manual
Single-Section (UICollectionView)
- Define
SectionDataController
in ViewController
let collectionView: UICollectionView
var models: [Model]
let sectionDataController = SectionDataController<Model, CollectionViewAdapter>(
adapter: CollectionViewAdapter(collectionView: self.collectionView),
isEqual: { $0.id == $1.id } // If Model has Equatable, you can omit this closure.
)
- Bind Models to
SectionDataController
in ViewController
var models: [Model] = [β¦] {
didSet {
sectionDataController.update(items: items, updateMode: .partial(animated: true), completion: {
// Completed update
})
}
}
- Implement UICollectionViewDataSource in ViewController
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return sectionDataController.numberOfItems()
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! Cell
let m = sectionDataController.item(for: indexPath)
cell.label.text = m.title
return cell
}
Multiple-Section (UICollectionView)
- Define
DataController
in ViewController
let collectionView: UICollectionView
var models: [Model]
let dataController = DataController<CollectionViewAdapter>(adapter: CollectionViewAdapter(collectionView: self.collectionView))
- Define
Section<T>
in ViewController
let section0 = Section(ModelA.self, isEqual: { $0.id == $1.id })
let section1 = Section(ModelB.self, isEqual: { $0.id == $1.id })
- Add
Section
toDataController
Order of Section will be decided in the order of addition.
dataController.add(section: section0) // will be 0 of section
dataController.add(section: section1) // will be 1 of section
- Bind Models to DataController
var section0Models: [ModelA] = [β¦] {
didSet {
dataController.update(
in: section0,
items: section0Models,
updateMode: .partial(animated: true),
completion: {
})
}
}
var section1Models: [ModelA] = [β¦] {
didSet {
dataController.update(
in: section1,
items: section1Models,
updateMode: .partial(animated: true),
completion: {
})
}
}
- Implement UICollectionViewDataSource
func numberOfSections(in collectionView: UICollectionView) -> Int {
return dataController.numberOfSections()
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return dataController.numberOfItems(in: section)
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
return dataController.item(
at: indexPath,
handlers: [
.init(section: section0) { (m: ModelA) in
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! Cell
cell.label.text = m.title
return cell
},
.init(section: section1) { (m: ModelB) in
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! Cell
cell.label.text = m.title
return cell
},
])
/* Other way
switch indexPath.section {
case section0:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! Cell
let m = _dataController.item(at: indexPath, in: section0)
cell.label.text = m.title
return cell
case section1:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! Cell
let m = _dataController.item(at: indexPath, in: section1)
cell.label.text = m.title
return cell
default:
fatalError()
}
*/
}
Reorder by UI operation
SectionDataController
has a snapshot for List-UI
.
It helps that perform batch update List-UI in safety.
But, the snapshots include side-effects.
For example, if we did reorder items of List-UI
by UI operation.
In this time, Items of List-UI is caused differences to the snapshot.
It will be caused unnecessary diff.
Therefore when we reorder items, we should operation followings.
- Reorder items of UI
- Call
SectionDataController.reserveMoved(...
- Reorder items of Array
- Call
SectionDataController.update(items: [T]..
Appendix
Combination with RxSwift
We can use DataControllers with RxSwift. The following code is an example.
Add extension
import RxSwift
import DataControllers
extension SectionDataController : ReactiveCompatible {}
extension Reactive where Base : SectionDataControllerType {
public func partialUpdate<
T,
Controller: ObservableType
>
(animated: Bool) -> (_ o: Source) -> Disposable where Source.E == [T], T == Base.ItemType {
weak var t = base.asSectionDataController()
return { source in
source
.observeOn(MainScheduler.instance)
.concatMap { (newItems: [T]) -> Completable in
Completable.create { o in
guard let sectionDataController = t else {
o(.completed)
return Disposables.create()
}
sectionDataController.update(items: newItems, updateMode: .partial(animated: animated), completion: {
o(.completed)
})
return Disposables.create()
}
}
.subscribe()
}
}
}
let models: Variable<[Model]>
let sectionDataController = SectionDataController<Model, CollectionViewAdapter>
models
.asDriver()
.drive(sectionDataController.rx.partialUpdate(animated: true))
Demo Application
This repository include Demo-Application. You can touch DataSources.
- Clone repository.
$ git clone https://github.com/muukii/DataSources.git
$ cd DataSources
$ pod install
- Open xcworkspace
- Run
DataSourcesDemo
on iPhone Simulator.
Installation
CocoaPods
pod 'DataSources'
Carthage
github "muukii/DataSources"
You need to add DataSources.framework
and ListDiff.framework
to your project.
Author
muukii, [email protected], https://muukii.me/
License
DataSources is available under the MIT license. See the LICENSE file for more info.
*Note that all licence references and agreements mentioned in the DataSources README section above
are relevant to that project's source code only.