Latest 0.2.0
Homepage https://github.com/fight4j/FFJLoadButton
License MIT
Platforms ios 8.0, requires ARC
Authors

CI Status
Version
License
Platform

FFJLoadButton is a simple subclass of UIButton written in Swift, which provides animations for loading.

FFJLoadButton
FFJLoadButton

Usage

FFJLoadButton mainly offers 2 methods:

startLoad()
endLoad(_:)

Example:

self.loadButton.startLoad()

let imageURL = NSURL.init(string: "https://fakeurl.com")
NSURLSession.sharedSession().dataTaskWithURL(imageURL!) { (imageData, response, error) -> Void in
    dispatch_async(dispatch_get_main_queue(), { () -> Void in
        if let _ = error {
            self.imageView.image = nil
            self.loadButton.endLoad(false)
            return
        }
        self.imageView.image = UIImage.init(data: imageData!)
        self.loadButton.endLoad(true)
    })
}.resume()

Check demo for more details.

Installation

CocoaPods

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

pod "FFJLoadButton"

To run the example project, clone the repo, and run pod install from the Example directory first.

Manually

Simply drag FFJLoadButton.swift to your project

Requirements

iOS 8.0+

Author

[email protected]

License

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

Latest podspec

{
    "name": "FFJLoadButton",
    "version": "0.2.0",
    "summary": "FFJLoadButton is a simple subclass of UIButton written in Swift, which provides animations for loading.",
    "description": "A simple subclass of UIButton that provides animations for loading, including loading, load succeed, load fail.",
    "homepage": "https://github.com/fight4j/FFJLoadButton",
    "license": "MIT",
    "authors": {
        "Vito": "[email protected]"
    },
    "source": {
        "git": "https://github.com/fight4j/FFJLoadButton.git",
        "tag": "0.2.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "FFJLoadButton": [
            "Pod/Assets/*.png"
        ]
    }
}

Pin It on Pinterest

Share This