Latest 1.2.3
License MIT
Platforms ios 8.0


Pull to refresh
Load more data next page

If you find it difficult or uncomfortable when having to write the code again while working with data paging, PagingDataController framework is a solution for you. It’s simple and extremely easy to use. Let me help you get started:


  • XCode 8+
  • Swift 3+
  • iOS 8+


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

pod 'PagingDataControllerExtension'


NGUYEN CHI CONG, [email protected]


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

Getting started

Provider: provider is a controller, it will retrieve data by page number
  • Creating a provider.
  • Implement loadData method

    struct GithubUsersProvider: PagingProviderProtocol {
    //custom pageSize here
    var pageSize: Int = 36
     * Replace type of Parameters and Return model by custom type in your app
     * Example:
     * func loadData(_ parameters: <#ParamterType#>?, page: Int, completion: (([<#ReturnType#>], Error?) -> ())?)
    func loadData(_ parameters: AnyObject?, page: Int, completion: (([Dictionary<String, AnyObject>], Error?) -> ())?) {
        let apiPath = ""
        Alamofire.request(apiPath, method: .get).responseJSON { (response) in
            var error: Error? = response.result.error
            var result: [[String: AnyObject]] = []
            defer {
                completion?(result, error)
            guard let data = (response.result.value as? [String: AnyObject]) else {
            result = data["items"] as! [[String: AnyObject]]
    Implement view controller conform PagingControllerProtocol protocol
class GithubUsersViewController: UIViewController , PagingControllerProtocol {
  • Declare provider to get data by page. Replace provider by your provider.
    lazy var provider = GithubUsersProvider()
  • Setup for paging data. All you have to do is copying the below method into your view controller.

     Copy this method into your view controller
    override func viewDidFinishLayout() {
  • All done. Too easy, right?. Good luck!

Latest podspec

    "name": "PagingDataController",
    "version": "1.2.3",
    "summary": "A Swift pattern to apply paging data to UIViewController",
    "description": "Only configure some properties & your view controller will load data by page automatically.nMagic !!!",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "NGUYEN CHI CONG": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.2.3"
    "social_media_url": "",
    "platforms": {
        "ios": "8.0"
    "source_files": "PagingDataController/Classes/**/*"

Pin It on Pinterest

Share This