Latest 1.0.0
Homepage https://github.com/pontake-dev/PTDLoadingViewController
License MIT
Platforms ios 9.0
Authors

Carthage compatible
Version
License
Platform

PTDLoadingViewController implements a simple code to inform the user during loading.
PTDLoadingViewControllerは通信中など、読み込みを行なっていることをユーザーに知らせるための画面をシンプルなコードで実装できます。

Description

  • Simple loading screen. This is a display type that covers all screens. It is conceivable to use it when you do not want the user to do other actions.
    端末全ての画面を覆う表示タイプ。例えば処理が終わるまでユーザーに何も操作してほしくない時などに使用できます。

sample image_001

  • You can also display the loading screen on the specified view. For example, the buttons of UITabBar and UINavigationBar may be used when you want to enable it.
    指定したviewの上に表示させることもできます。
    UITabBarやUINavigationBarのボタンは有効にしたい時などを想定してます。

sample image_002

  • Can also add a cancel button to the above two display types and display it.
    上記の2パターンの表示にキャンセルボタンを追加して表示させることもできます。

    Can detect that you tapped the cancel button with a closure.
    キャンセルボタンをタップした事をクロージャで取得できます。

    The display of the cancel button can be customized.
    キャンセルボタンの表示はカスタマイズ可能です。

    sample image_003

    sample image_004

Example Usages

// MARK: covering all screens.

let loadingView = PTDLoadingViewController.shared
loadingView.showLoadingIndicatorCoveringAllScreens()

//disappear after 2 seconds.
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
    //hide indicator
    loadingView.hideLoadingIndicator()
}

// MARK: above the specified view

let loadingView = PTDLoadingViewController.shared
loadingView.showLoadingIndicatorOnView(self.view)

//disappear after 2 seconds.
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
    //hide indicator
    loadingView.hideLoadingIndicator()
}

// MARK: cancelable indicator covering all screens
let loadingView = PTDLoadingViewController.shared
loadingView.showCancelableLoadingIndicatorCoveringAllScreens {
    print("cancel button tapped")
    //hide indicator
    loadingView.hideLoadingIndicator()
}

//disappear after 5.0 seconds.
DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
    //hide indicator
    loadingView.hideLoadingIndicator()
}

// MARK: cancelable above the specified view
let loadingView = PTDLoadingViewController.shared
loadingView.showCancelableLoadingIndicatorOnView(self.view) {
    print("cancel button tapped")
    //hide indicator
    loadingView.hideLoadingIndicator()
}

//disappear after 5.0 seconds.
DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
    //hide indicator
    loadingView.hideLoadingIndicator()
}

// MARK: example of decorating a cancel button
let loadingView = PTDLoadingViewController.shared
loadingView.cancelButton.backgroundColor = UIColor.green
loadingView.cancelButton.layer.cornerRadius = 5
//and so on

Installation

CocoaPods

Add to Podfile:

pod 'PTDLoadingViewController'

Carthage

Add to Cartfile:

github "pontake-dev/PTDLoadingViewController"

License

MIT

Latest podspec

{
    "name": "PTDLoadingViewController",
    "version": "1.0.0",
    "summary": "PTDLoadingViewController implements a simple code to inform the user during loading.",
    "description": "PTDAlertViewController is a wrapper around UIalertcontroller that displays Alerts with simple code.nn  Example Usagesnn  ```swiftn  // MARK: covering all screens.nnlet loadingView = PTDLoadingViewController.sharednloadingView.showLoadingIndicatorCoveringAllScreens()nn//disappear after 2 seconds.nDispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {n    //hide indicatorn    loadingView.hideLoadingIndicator()n}nn// MARK: above the specified viewnnlet loadingView = PTDLoadingViewController.sharednloadingView.showLoadingIndicatorOnView(self.view)nn//disappear after 2 seconds.nDispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {n    //hide indicatorn    loadingView.hideLoadingIndicator()n}nn// MARK: cancelable indicator covering all screensnlet loadingView = PTDLoadingViewController.sharednloadingView.showCancelableLoadingIndicatorCoveringAllScreens {n    print("cancel button tapped")n    //hide indicatorn    loadingView.hideLoadingIndicator()n}nn//disappear after 5.0 seconds.nDispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {n    //hide indicatorn    loadingView.hideLoadingIndicator()n}nn// MARK: cancelable above the specified viewnlet loadingView = PTDLoadingViewController.sharednloadingView.showCancelableLoadingIndicatorOnView(self.view) {n    print("cancel button tapped")n    //hide indicatorn    loadingView.hideLoadingIndicator()n}nn//disappear after 5.0 seconds.nDispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {n    //hide indicatorn    loadingView.hideLoadingIndicator()n}nn// MARK: example of decorating a cancel buttonnlet loadingView = PTDLoadingViewController.sharednloadingView.cancelButton.backgroundColor = UIColor.greennloadingView.cancelButton.layer.cornerRadius = 5n//and so onn  ```",
    "homepage": "https://github.com/pontake-dev/PTDLoadingViewController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "pontake-dev": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "swift_version": "4.0",
    "source": {
        "git": "https://github.com/pontake-dev/PTDLoadingViewController.git",
        "tag": "1.0.0"
    },
    "source_files": "PTDLoadingViewController/**/*.{swift}"
}

Pin It on Pinterest

Share This