Home

Awesome

CI Status Version License Platform Swift 5.2.x

Folio

Flexible way to detect when you scroll to the end of a UITableView.

project logo

What is Folio?

Sometimes it's valuable to detect when you scroll to the end of a UITableView. One scenario is if your app is trying to implement pagination. Folio's job is to tell you when you have scrolled to the bottom of your UITableView. Nothing more, nothing less.

Why use Folio?

Installation

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

pod 'Folio', '~> version-here'

Replace version-here with: Version as this is the latest version at this time.

Getting started

import UIKit
import Folio

class ViewController: UIViewController {

    fileprivate var folio: Folio!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        folio = Folio(tableView: tableView)
        folio.delegate = self
        ...
    }
}
extension ViewController: FolioDelegate {

    func reachedBottom(in tableView: UITableView) {
        // Reached bottom of UITableView. 
        //
        // Note: This function is only called once until you call `tableView.reloadData()`. 
    }
}
extension ViewController: UITableViewDelegate {
    
    func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {        
        folio.tableView(tableView, willDisplay: cell, forRowAt: indexPath)
    }

}

Example app

This project comes with an iOS app you can run and view the source code to get an idea of a full implementation of pagination with Folio.

To run the example app, follow these instructions:

cd Example/
pod install

Then, open the Folio workspace in XCode.

Author

Levi Bostian image

Contribute

Folio is open for pull requests. Check out the list of issues for tasks planned out, if there are any. Check them out if you wish to contribute in that way.

Want to add features to Folio? Before you decide to take a bunch of time and add functionality to the library, please, create an issue stating what you wish to add. This might save you some time in case your purpose does not fit well in the use cases of Folio. Nothing is stopping you from making a fork of this library and making any changes you wish!

Where did the name come from?

After a quick search for synonyms of "paging", folio came up. Folio is defined as arranging sheets of paper in a certain order. Fun word that aligns well with what it's common use case -> paging.

Credits

Header photo by JJ Ying on Unsplash

License

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