Skip to content

This simple extension adds progress indicator to rounded UIButton

License

Notifications You must be signed in to change notification settings

AlexSmet/ExtButtonProgress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExtButtonProgress

Version Platform Language License

This simple extension adds progress indicator to rounded UIButton.

Usage

Just add file ExtButtonProgress.swift in your project. Use method showProgressIndicator( width:color:backgroundColor:cycleDuration:) to begin show progress indicator and method hideProgressIndicator() to hide indicator.

Important! Button must be rounded for using this extension.

Code example

class ViewController: UIViewController {
    
    // Our rounded button
    @IBOutlet weak var roundedButton: UIButton!
    
    // Push 'Start' button
    @IBAction func pushStart(_ sender: UIButton) {
        // Show progress indicator for our buttnon 
        roundedButton.showProgressIndicator(width: 5, color: UIColor.purple, backgroundColor: UIColor.lightGray, cycleDuration: 7.0)
    }
    
    // Push 'Stop' button
    @IBAction func pushStop(_ sender: UIButton) {
        // Hide progress indicator
        roundedButton.hideProgressIndicator()
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
  
        // Make rounded button
        roundedButton.layer.cornerRadius = 0.5 * buttonWithProgressbar.bounds.size.width
        roundedButton.clipsToBounds = true
    }
}

Installation

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

pod "ExtButtonProgress", :git => 'https://github.com/AlexSmet/ExtButtonProgress.git'

Author

Created by Alexander Smetannikov ([email protected]) Thanks to Evgeny Safronov

License

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

About

This simple extension adds progress indicator to rounded UIButton

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published