Swiftpack.co - Package - XaoflySho/XSRefresh

English|简体中文

XSRefresh GitHub license podversion Carthage

An easy way to use pull-to-refresh, Swift version of MJRefresh.

Release notes

Install

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate XSRefresh into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'XSRefresh'

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate XSRefresh into your Xcode project using Carthage, specify it in your Cartfile:

github "XaoflySho/XSRefresh"

Manual

Drag All files in the XSRefresh/Sources folder to project.

Usage

Quick start

import XSRefresh

func tableViewRefreshSetting() {
  // Header, the drop-down refresh control.
  tableView.xs.header = XSRefreshNormalHeader { [weak self] in
    // Refreshing code...
	  
    // End refreshing.
    self?.tableView.xs.header?.endRefreshing()
  }
	
  // Footer, the pull to refresh control.
  tableView.xs.footer = XSRefreshAutoNormalFooter { [weak self] in
    // Load or refreshing Code...
    
    // End refreshing.
    self?.tableView.xs.footer?.endRefreshing()
  }
}

More

import XSRefresh

func tableViewRefreshSetting() {
  // Header, the drop-down refresh control.
  tableView.xs.header = XSRefreshNormalHeader(withRefreshing: self, action: #selector(refresh))
  // Footer, the pull to refresh control.
  tableView.xs.footer = XSRefreshAutoNormalFooter(withRefreshing: self, action: #selector(loadMoreData))
}

@objc func refresh() {
  // Refreshing code...
  
  // End refreshing.
  tableView.xs.header?.endRefreshing()
}

@objc func loadMoreData() {
  // Load or refreshing Code...
  
  // End refreshing.
  if noMoreData {
    // No more data.
    tableView.xs.footer?.endRefreshingWithNoMoreData()
  } else {
    // End refreshing.
    tableView.xs.footer?.endRefreshing()
  }
}

Example Readmes

To see how the specification has been applied, see the example-readmes.

TODO List

  • ☑ Support for Carthage management tools

  • ☐ ~~Support for Swift package management tools~~

  • ☑ Support horizontal scroll control, eg.CollectionView

  • ☐ ......

Maintainers

@XaoflySho.

License

MIT © Xaofly Sho

Github

link
Stars: 2

Dependencies

Used By

Total: 0