Thursday 16 May 2019

Pulldown Refresh Demo

Check source code at Github:
https://github.com/Sylvia-YiyinShen/PulldownRefreshDemo

There are several different ways to implement pull-down refresh. One is based on scrollView delegate functions, another one is based on key-value observing on contentOffset. My demo is implemented via the later approach, since when applying the pull-down refreshing to a tableVIew it just requires 2-line changes.



How to use
  • Grab Indicator and PulldownRefresh folder to your project
  • Make your tableView subclassing RefreshableTableView
  • Invoke RefreshableTableView func configureRefreshControl(refreshHandler: @escaping () -> Void)
  • Invoke in the right place RefreshableTableView  func refreshDone()


Note: Look at the RefreshableTableView.swift if you also want to apply refreshControl to CollectionView


No comments:

Post a Comment