TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Apr 2016 |
SPMSupports SPM | ✗ |
Maintained by Vito.
FFJLoadButton is a simple subclass of UIButton written in Swift, which provides animations for loading.
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.
Simply drag FFJLoadButton.swift to your project
iOS 8.0+
FFJLoadButton is available under the MIT license. See the LICENSE file for more info.