Latest 1.0.2
Homepage https://github.com/srv7/LoadingRetry
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.

Requirements

iOS 9.0+
swift 4.2+

Usage

  1. confirm to protocol LoadingRetryType. e.g.

    class ViewController: UIViewController, LoadingRetryType {
    
    }
  2. implement requirements of protocol LoadingRetryType, provide your loadingView and errorView viewControllerType.

    class ViewController: UIViewController, LoadingRetryType {
       lazy var loadingView: LoadingViewController = {
           return LoadingViewController()
       }()
    
       lazy var errorView: ErrorViewController = {
           return ErrorViewController()
       }()
    }
  3. call setLoadingView(visible: Bool) and setErrorView(visible: Bool) to control the display of loadingView and errorView.

    viewController.setLoadingView(visible: visible)
    viewController.setErrorView(visible: visible)

Installation

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

pod 'LoadingRetry'

Rx Support

pod 'LoadingRetry/RxSwift'

LoadingRetry also add rx support. if you are using RxSwift, you can control the display of loadingView and errorView by using loadingViewVisible and errorViewVisible extension property of UIViewController.

viewModel.fetchDataAction.executing.bind(to: rx.loadingViewVisible).disposed(by: bag)

viewModel.fetchDataAction.executing
            .filter { $0 }.map { !$0 }
            .bind(to: rx.errorViewVisible)
            .disposed(by: bag)

        viewModel.fetchDataAction.errors
            .map { _ in true }
            .bind(to: rx.errorViewVisible)
            .disposed(by: bag)

Author

srv7, [email protected]

License

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

Latest podspec

{
    "name": "LoadingRetry",
    "version": "1.0.2",
    "summary": "Loading and Retry",
    "description": "simple loading and retry tool",
    "homepage": "https://github.com/srv7/LoadingRetry",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "srv7": "[email protected]"
    },
    "source": {
        "git": "https://github.com/srv7/LoadingRetry.git",
        "tag": "1.0.2"
    },
    "platforms": {
        "ios": "9.0"
    },
    "swift_versions": "5.0",
    "default_subspecs": "Core",
    "subspecs": [
        {
            "name": "Core",
            "source_files": "LoadingRetry/Classes/Core/**/*",
            "frameworks": "UIKit"
        },
        {
            "name": "RxSwift",
            "source_files": "LoadingRetry/Classes/RxSupport/**/*",
            "dependencies": {
                "LoadingRetry/Core": [],
                "RxCocoa": []
            }
        }
    ]
}

Pin It on Pinterest

Share This