Swiftpack.co - lukaswuerzburger/PaginationKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by lukaswuerzburger.
lukaswuerzburger/PaginationKit 2.0.0
PaginationController provides logic to paginate through a list.
⭐️ 3
🕓 2 years ago
iOS
.package(url: "https://github.com/lukaswuerzburger/PaginationKit.git", from: "2.0.0")

PaginationKit
PaginationKit

Swift Version Build Status CocoaPods Compatible License MIT

Contents

✍️ Description

The PaginationController provides the logic to paginate through a list with limited request results. It also provides a TableViewPaginationController that adds and removes a loading view to the tableFooterView.

🖥 Example

class ViewController: UITableViewController {

    var items: [String] = []

    override func viewDidLoad() {
        super.viewDidLoad()

        paginationController = TableViewPaginationController(tableView: tableView) { previousPage, callback in

            // Imagine an API call being made here.
            self.loadMore(after: previousPage) { page in
                self.items += page?.results ?? []
                self.tableView.reloadData()
                callback(page)
            }
        }
    }
}

🎟 Demo

PaginationKit Demo

You can find this demo app in this repository.

🔨 Customization

Custom Loading View:

If you want to show your own loading view you can use any UIView conforming to the LoadingAnimatable protocol described here.

Pass it to the initializer:

paginationController = TableViewPaginationController(loadingView: MyLoadingView(), ...)

Or set the property:

paginationController.loadingView = MyLoadingView()

Check out the Demo

💻 How to use

Cocoapods:
PaginationKit is available on Cocoapods. Just put following line in your Podfile:

pod 'PaginationKit'

Swift Package Manager:
Add the following to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/lukaswuerzburger/PaginationKit.git", from: "1.0.0")
]

⚠️ Requirements

  • Swift 5+
  • iOS 10+
  • Xcode 11+

💪 Contribute

Issues and pull requests are welcome.

GitHub

link
Stars: 3
Last commit: 45 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics