Skip to content

KKProgressToolbar is an iOS drop-in class that displays a translucent UIToolbar with a progress indicator and some optional labels while work is being done in a background thread

License

aporat/KKProgressToolbar

Repository files navigation

KKProgressToolbar

KKProgressToolbar is an iOS toolbar library

Build Status Cocoapods Swift Xcode MIT

   

Demo

build and run the KKProgressToolbarExample project in Xcode to see KKProgressToolbar in action.

Installation

The recommended approach for installing SocialAccounts is via the CocoaPods package manager, as it provides flexible dependency management and dead simple installation.

Install CocoaPods if not already available:

$ [sudo] gem install cocoapods
$ pod setup

Edit your Podfile and add KKProgressToolbar:

$ edit Podfile
platform :ios, '12.0'

pod 'KKProgressToolbar'

Install into your Xcode project:

$ pod install

Add import KKProgressToolbar" to the top of classes that will use it.

Example Usage

Showing and Hiding the toolbar

class ViewController: UIViewController {
    
    lazy fileprivate var loadingToolbar: KKProgressToolbar = {
        let view = KKProgressToolbar()
        view.progressBar.barBorderColor = .black
        view.progressBar.barBackgroundColor = .black
        view.progressBar.barBorderWidth = 1
        view.progressBar.barFillColor = .white
        view.isHidden = true
        return view
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        loadingToolbar.actionDelegate = self
        loadingToolbar.frame = CGRect(x: 0, y: view.bounds.size.height, width: view.bounds.size.width, height: 55)
        view.addSubview(loadingToolbar)
        
    }
    
    @IBAction func showToolbar(_ sender: Any) {
        loadingToolbar.show(true, completion: nil)
        loadingToolbar.text = NSLocalizedString("Loading...", comment: "")
        loadingToolbar.progressBar.progress = 0.5
    }
    
    @IBAction func hideToolbar(_ sender: Any) {
        loadingToolbar.hide(true, completion: nil)
    }
}

// MARK: - KKProgressToolbarDelegate
extension ViewController: KKProgressToolbarDelegate {
    func didCancelButtonPressed(_ toolbar: KKProgressToolbar) {
        
    }
}

About

KKProgressToolbar is an iOS drop-in class that displays a translucent UIToolbar with a progress indicator and some optional labels while work is being done in a background thread

Resources

License

Stars

Watchers

Forks

Packages

No packages published