A controller for displaying background activity UI.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
KRIndicatorController.xcodeproj
KRIndicatorController
KRIndicatorControllerExample
KRIndicatorControllerTests
KRIndicatorController.podspec
LICENSE
README.md

README.md

KRIndicatorController

KRIndicatorController is a controller for displaying background activity UI.

Version License Platform

Installation

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

pod 'KRIndicatorController', :git=>'https://github.com/funct7/KRIndicatorController.git', :branch=>'develop'

Then, run the following command:

$ pod install

Usage

Basic

Using the default indicator view:

import KRIndicatorController

class ViewController: UIViewController {
    
    private let ic = IndicatorController()

    private func beginOperation() {
        ic.increment()

        // Begin some operation
    }
    
    private func endOperation() {
        // End some operation
        
        ic.decrement()
    }

}

Custom indicator view

Using a custom indicator view:

import KRIndicatorController

class CustomIndicator: IndicatorItem {
    
    var view: UIView
    init() {
        // Initialize
    }
    
    func animateShow() {
        // Custom animation
    }
    
    func animateHide() {
        // Custom animation
    }
    
}

class ViewController: UIViewController {
    
    private let ic = IndicatorController()

    private func setCustomIndicatorView() {
        ic.indicatorItem = CustomIndicator()
    }

}

Custom delay

Setting a custom delay value:

import KRIndicatorController

class ViewController: UIViewController {
    
    private let ic = IndicatorController()

    private func setCustomDelay() {
        ic.delay = 0.3  // 300 ms delay
    }

}

Block/allow user interaction

Blocking the user interaction during indicator display:

import KRIndicatorController

class ViewController: UIViewController {

    private let ic = IndicatorController()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        ic.isUserInteractionBlocked = true // Default is true
    }

}

Setting isUserInteractionBlocked to false allows users to interact with the underlying view.