Skip to content

Repository files navigation

FetchingView

CI StatusVersionLicensePlatform

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 :

enumFetchingState<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
classViewController:UIViewController{@IBOutlet weak vartableView:UITableView!varfetchingView:FetchingView<[User]>!func viewDidLoad(){
super.viewDidLoad()...self.fetchingView =FetchingView(listView: tableView, parentView:self.view)}func fetchResource(){self.fetchingView.fetchingState =.fetching
User.fetchResource{ result iniflet error = result.error {self.fetchingView.fetchingState =.fetchedError(error)}iflet 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, neilsultimatelab@icloud.com

License

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

Releases

Packages

Contributors

Languages