Latest 0.5.1
Homepage https://github.com/dclelland/RefreshableViewController
License MIT
Platforms ios 10.0
Authors

RefreshableViewController

RefreshableViewController is simple view controller with refreshable state management based on PromiseKit.

Example usage:

import UIKit
import PromiseKit
import RefreshableViewController

struct APIClient {

    static func getItem(itemID: Int) -> Promise<Item> {
        return Promise { fulfill, reject in
            // Make HTTP requests, etc...
            let item = Item(name: "Item Name")
            fulfill(item)
        }
    }

}

struct Item {

    let name: String

}

class ItemViewController: RefreshableViewController<Item> {

    convenience init(itemID: Int) {
        self.init(request: APIClient.getItem(itemID: itemID))
    }

    override func refreshState() {
        super.refreshState()

        switch state {
        case .ready:
            print("View controller is ready")
        case .loading:
            print("View controller is loading")
        case .success(let item):
            print("View controller loaded item with name: (item.name)")
        case .failure(let error):
            print("View controller failed to load item with error: (error)")
        }
    }

}

Latest podspec

{
    "name": "RefreshableViewController",
    "version": "0.5.1",
    "summary": "RefreshableViewController is simple view controller with refreshable state management based on PromiseKit.",
    "homepage": "https://github.com/dclelland/RefreshableViewController",
    "license": {
        "type": "MIT"
    },
    "authors": {
        "Daniel Clelland": "[email protected]"
    },
    "source": {
        "git": "https://github.com/dclelland/RefreshableViewController.git",
        "tag": "0.5.1"
    },
    "ios": {
        "source_files": "Sources/**/*.swift",
        "dependencies": {
            "PromiseKit": [
                "~> 4.0"
            ]
        }
    },
    "platforms": {
        "ios": "10.0"
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This