GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - NeilsUltimateLab/FetchingView: View to indicate data fetching states.

BranchesTags
Open more actions menu

Latest commit

 

History

24 Commits
24 Commits

Folders and files

NameName
Last commit message
Last commit date
Example
Example
 
 
FetchingView
FetchingView
 
 
.gitignore
.gitignore
 
 
.swift-version
.swift-version
 
 
.travis.yml
.travis.yml
 
 
FetchingView.podspec
FetchingView.podspec
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
_Pods.xcodeproj
_Pods.xcodeproj
 
 
_config.yml
_config.yml
 
 

Repository files navigation

FetchingView

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.

About

View to indicate data fetching states.

Topics

heads-up-displayhudindicatorviewloaderplaceholderstackviewtableview-collectionview-loadingtoastwebservice-loading

Resources

Readme
MIT license
Activity

Stars

3 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.