Skip to content

FabioTacke/DownloadingProgressButton

 
 

Repository files navigation

DownloadingProgressButton

Version License Platform

demo

Installation

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

pod "DownloadingProgressButton"

Usage

You can use a DownloadingProgressButton on Storyboards

When the button is clicked, it will animate to pending rotation circle, inform you to start downloading and wait for downloading progress. You must implement delegate method:

func stateWasChanged(to newState: DownloadStates, sender: DownloadingProgressButton) {
    if newState == .pending {
        // MARK: perform some actions and inform button
        sender.downloadingStarted()
    }
}
// MARK: change downloading progress
button.downloadingProgressChanged(to: 0.2)

When this value reaches >= 1.0, then button is automatically animates to the end and takes done state.

To set or reset downloaded state:

button.downloadingSet()
button.downloadingReset()

To start animations programmatically:

button.startProgrammatically()

You can customize properties from Interface Builder:

properties

Example

To run the example project, clone the repo, choose Xcode 8 or Xcode 9 project and run pod install from the directory first.

Requirements

Swift 3+

Xcode 8+

Author

VAndrJ

License

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 97.5%
  • Ruby 2.5%