sta

StatefulTableView

Custom UITableView container class that supports pull-to-refresh, load-more, initial load, and empty states.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

59

Maintenance

Last Commit

1yr ago

Contributors

1

Package

Dependencies

0

License

MIT

Categories

Readme

StatefulTableView

Version License Platform Platform Build Status

Custom UITableView container class that supports pull-to-refresh, load-more, initial load, and empty states. This library aims to be a drop in replacement for UITableView. Swift port of SKStatefulTableViewController.

This is a work in progress. A lot of things may break as of the moment.

Screenshots

Initial loading:

Pull-to-refresh:

Load more:

Initial load error:

Load more error:

Usage

Currently, you can only assign the delegates and data source through code.

tableView.dataSource = self // Confofrms to UITableViewDataSource
tableView.delegate = self // Conforms to UITableViewDelegate
tableView.statefulDelegate = self // Conforms to StatefulTableDelegate

For initial loading, pull-to-refresh, and load more, you have to implement the following statefulDelegate methods:

func statefulTableViewWillBeginInitialLoad(tvc: StatefulTableView, handler: InitialLoadCompletionHandler)
func statefulTableViewWillBeginLoadingFromRefresh(tvc: StatefulTableView, handler: InitialLoadCompletionHandler)
func statefulTableViewWillBeginLoadingMore(tvc: StatefulTableView, handler: LoadMoreCompletionHandler)

To show custom views, return them through the following statefulDelegate methods. Otherwise, return nil.

func statefulTableViewViewForInitialLoad(tvc: StatefulTableView) -> UIView?
func statefulTableViewInitialErrorView(tvc: StatefulTableView, forInitialLoadError: NSError?) -> UIView?
func statefulTableViewLoadMoreErrorView(tvc: StatefulTableView, forLoadMoreError: NSError?) -> UIView?

Installation

Cocoapods

Add this to your Podfile.

pod 'StatefulTableView', '0.1.6'

Contibuting

Pull Requests for fixes and additional functionalities are always welcome. Contributions to the project's roadmap are also appreciated.

TODO

  • Swift 4

Credits

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100