To run the example project clone the repo and run pod install
from the Demo directory first.
POSInfiniteScroll is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod POSInfiniteScroll
Add POSInfiniteScroll to your Cartfile:
github "postolaki/posinfinitescroll"
And then run:
carthage update or carthage update --use-xcframeworks
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler.
Once you have your Swift package set up, adding POSInfiniteScroll as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/postolaki/POSInfiniteScroll.git")
]
import POSInfiniteScroll
// setup infinite scroll
tableView.addInfiniteScroll { tableView in
// finish infinite scroll animation
tableView.finishInfiniteScroll()
}
collectionView.addInfiniteScroll { collectionView in
// finish infinite scroll animation
collectionView.reloadDataAndFinishInfIniteScroll()
}
tableView.shouldRemoveInfiniteScrollHandler = { _ in
return condition to remove infinite scroll
}
func addInfiniteScroll(_ completion: @escaping (UITableView) -> Void)
func addInfiniteScroll(_ completion: @escaping (UICollectionView) -> Void)
func finishInfiniteScroll(_ completion: (() -> Void)? = nil)
func removeInfiniteScroll()
var infiniteScrollTriggerOffset: CGFloat
var shouldRemoveInfiniteScrollHandler: () -> Bool
Custom indicator must conform to protocol SpinnerViewProtocol
protocol SpinnerViewProtocol: UIView {
func startAnimating()
func stopAnimating()
}
var infiniteScrollSpinnerView: SpinnerViewProtocol?
// setup pull to refresh
tableView.addPullToRefresh { tableView in
// finish pull to refresh animation
tableView.finishPullToRefresh()
}
collectionView.addPullToRefresh { collectionView in
// finish pull to refresh animation
collectionView.reloadDataAndFinishPullToRefresh()
}
func beginPullToRefresh(_ completion: (() -> Void)? = nil)
func addPullToRefresh(_ completion: @escaping (UITableView) -> Void)
func addPullToRefresh(_ completion: @escaping (UICollectionView) -> Void)
func finishPullToRefresh(_ completion: (() -> Void)? = nil)
func removePullToRefresh()
var pullToRefreshTriggerOffset: CGFloat
Custom indicator must conform to protocol PullToRefreshSpinnerViewProtocol
protocol PullToRefreshSpinnerViewProtocol: SpinnerViewProtocol {
var progress: CGFloat { get set }
var isAnimating: Bool { get }
}
var pullToRefreshSpinnerView: PullToRefreshSpinnerViewProtocol?
POSInfiniteScroll is available under the MIT license.
link |
Stars: 4 |
Last commit: 1 year ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics