Latest 0.2.1
Homepage https://github.com/NeilsUltimateLab/FetchingView
License MIT
Platforms ios 9.0
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Fetching view has a state machine called Fetching State :

enum FetchingState<A> {
    case fetching
    case fetchedError(AppErrorProvider)
    case fetchedData(A)
}

Fetching view will display UIActivityIndicatorView for FetchingState<A>.fetching and error message for .fetchedError(Error) state.

Here is an screenshot from an example application using FetchingView

Screenshot of Example application

Requirements

Installation

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

pod 'FetchingView'

Usage

How to use FetchingView?

import UIKit
import FetchingView

class ViewController: UIViewController {

    @IBOutlet weak var tableView: UITableView!
    var fetchingView: FetchingView<[User]>!

    func viewDidLoad() {
        super.viewDidLoad()
        ...
        self.fetchingView = FetchingView(listView: tableView, parentView: self.view)
    }

    func fetchResource() {
        self.fetchingView.fetchingState = .fetching
        User.fetchResource { result in
            if let error = result.error {
                self.fetchingView.fetchingState = .fetchedError(error)
            }
            if let users = result.value {
                self.fetchingView.fetchingState = .fetchedData(users)
                //update dataSource and reloadData
            }
        }
    }

}

How to show HUD?


func showHUD() {
    self.fetchingView.showHUD()
    // task
    self.fetchingView.hideHUD()
}

func showMessageHUD() {
    self.fetchingView.showHUD(title: nil, message: "Your request is submitted successfully.", delay: 2.0)
}

Author

NeilsUltimateLab, [email protected]

License

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

Latest podspec

{
    "name": "FetchingView",
    "version": "0.2.1",
    "summary": "Views to indicate data fetching states.",
    "description": "Views to show on different states of data fetching. Shows indicator views for fetching state, error states etc.nFetchingView can show headsUpDisplay (HUD) for the toast. It supports indefinite, definite and message type of HUDs.",
    "homepage": "https://github.com/NeilsUltimateLab/FetchingView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "NeilsUltimateLab": "[email protected]"
    },
    "source": {
        "git": "https://github.com/NeilsUltimateLab/FetchingView.git",
        "tag": "0.2.1"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "FetchingView/Classes/**/*",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This