No description, website, or topics provided.
Swift Ruby
Switch branches/tags
Nothing to show
Latest commit c2143e8 Jul 16, 2017 @VAndrJ committed on GitHub Update README.md
Permalink
Failed to load latest commit information.
DownloadingProgressButton Initial Commit Jul 16, 2017
Example Initial Commit Jul 16, 2017
Images Initial Commit Jul 16, 2017
.gitignore Initial Commit Jul 16, 2017
.travis.yml Initial Commit Jul 16, 2017
DownloadingProgressButton.podspec Initial Commit Jul 16, 2017
LICENSE Initial Commit Jul 16, 2017
README.md Update README.md Jul 16, 2017

README.md

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.