Skip to content

Latest commit

 

History

History
95 lines (64 loc) · 2.69 KB

README.md

File metadata and controls

95 lines (64 loc) · 2.69 KB

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) {
        
    }
}