Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dreaminginbinary/genericdatasource

A Swift implementation of a generic datasource that you can use for table views.
https://github.com/dreaminginbinary/genericdatasource

Last synced: about 1 month ago
JSON representation

A Swift implementation of a generic datasource that you can use for table views.

Awesome Lists containing this project

README

        

![GenericDatasrouce](/pablo.png?raw=true "GenericDatasource")

# GenericDatasource
A Swift implementation of a generic datasource that you can use for table views.

####Snag it from CocoaPods
pod 'GenericDatasource', ~> '0.1.0'

###What is it for?
This simple class has only one job, to move your datasource logic outside of your controller. That's it :-). There are no tricks or anything special about it, other than it helps promote skinny view controllers.

###How do I use it?
Simply set up your GenericDatasource class with the information it needs in its initializer.

genericDataSource = GenericTVDatasource(data: data, cellID: "Cell") { cell, item in
//Do any cell configuration here
cell.textLabel?.text = item as? String
}

Whenever your table view is initialized, just set its datasource to your `GenericDatasouce` instance:

aTableview.dataSource = genericDataSource

And profit!

###What's coming?
- Support for collection views.
- Ability to specify sections.

###Can I tweet at you?
Please do, [@jordanmorgan10](https://twitter.com/jordanmorgan10). As the mantra goes - pull requests welcome.