RRPagingCollectionView
The simplest way to add paginate function to your collection view.
All you have to do is just set your collection view class in the storyboard to RRPagingCollectionView
, and implement the RRPagingCollectionViewDelegate#paginate
Example
Requirements
pod 'RxCocoa'
pod 'RxSwift'
pod 'RxGesture'
pod 'Kingfisher'
Installation
Manually
- Download the project.
- Add
RRPagingCollectionView.swift
,RRPagingCollectionViewDelegate.swift
&RRLoadingFooter.swift
with necessary files in your project. - Congratulations!
Usage example
First set your collection view class in the storyboard to RRPagingCollectionView
Then implement paginate
function. If isLoading
is set to true, an indicator is displayed at the bottom of the collection view. Otherwise, the indicator disappears and UICollectionView.reloadData
is called.
To run the example project, clone the repo, and run pod install from the Example directory first.
APIs
Name | Type | Description |
---|---|---|
pagingDelegate |
RRPagingCollectionViewDelegate |
Delegate pagination processing |
currentPage |
Int |
Returns the current page |
isLoading |
Bool |
Shows and hides the loading indicator. Reload collection view data after loading |
reset() |
Void |
Return page to 0 and call paginate function |