Swiftpack.co -  lukaswuerzburger/PaginationController as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
lukaswuerzburger/PaginationController
PaginationController provides logic to paginate through a list.
.package(url: "https://github.com/lukaswuerzburger/PaginationController.git", from: "1.0.0")

PaginationController
PaginationController

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

Pagination Controller 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:
PaginationController is available on Cocoapods. Just put following line in your Podfile:

pod 'PaginationController'

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

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

⚠️ Requirements

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

πŸ’ͺ Contribute

Issues and pull requests are welcome.

GitHub

link
Stars: 2
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

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