Need help with PaginatedTableView?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

salmaanahmed
166 Stars 23 Forks MIT License 13 Commits 2 Opened issues

Description

Assign this class to your UITableView and it will be equipped with pull to refresh as well as infinite scroll along with a callback where you don't have to worry about page number/size stuff. Thats why libraries exist :)

Services available

!
?

Need anything else?

Contributors list

# 439,760
Ruby
Swift
8 commits

PaginatedTableView

Swift 5 Version License Platform Country

Example

To run the example project, clone the repo, and run

pod install
from the Example directory first.

Demo



Pagination or Infinite scroll is a very necessary feature in modern apps. This library makes it super easy to implement infinite scroll.
No need to keep the page number or show/hide loader logic within the ViewController, it will stay as clean as you have simple table view. :+1:
Guess what, it comes with pull to refresh by default ;)

Usage

Step 1: Assign custom class

swift
  // Assign custom class to table view in storyboard
  @IBOutlet weak var tableView: PaginatedTableView!

Step 2: Remember to assign paginated delegate and data source ONLY, DO NOT assign

tableViewDelegate
or
tableViewDataSource
swift
  // Add paginated delegates only
  tableView.paginatedDelegate = self
  tableView.paginatedDataSource = self

Step 3: On

ViewDidLoad
call the load method with refresh true optional parameter
swift
  tableView.loadData(refresh: true)

Step 4: Implement stub and call api ```swift func loadMore(_ pageNumber: Int, _ pageSize: Int, onSuccess: ((Bool) -> Void)?, onError: ((Error) -> Void)?) { // Call your api here // Send true in onSuccess in case new data exists, sending false will disable pagination

    // If page number is first, reset the list
    if pageNumber == 1 { self.list = [Model]() }

// else append the data to list
self.list.append(apiResponseList)

// If Api responds with error
onError?(apiError)        

// Else end success with flag true if more data available
let moreDataAvailable = !apiResponseList.isEmpty
onSuccess?(moreDataAvailable)

}

The latest release supports swiping cells and listening to scroll changes, please see example for more features.

Step 5: Enjoy
Yeah! Thats all. You now have paginated table view with infinite scroll along with pull to refresh :heart:
Simple, isnt it?

Installation

PaginatedTableView is available through CocoaPods. To install it, simply add the following line to your Podfile:

```ruby pod 'PaginatedTableView'

Author

Salmaan Ahmed, [email protected]

License

PaginatedTableView is available under the MIT license. See the LICENSE file for more info.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.