akirahrkw / SSCircularProgress

CircularProgressView by swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SSCircularProgress

SSCircularProgress provides circular loading bar, like Instagram loading bar. This library is written by Swift, simple and easy to use.

Swift Version

this branch supports swift 2.0

Interface Builder

As SSCircularProgress inherits UIView and uses @IBDesignable, @IBInspectable, you can use it on IB and can change the line width and progress on Attributes Inspector

Code

if you are using SDWebImage, the callback for progress can be like this

@IBOutlet weak var progressView: SSCircularProgress!
...
...

var progress = { [unowned self] (receivedSize: NSInteger, expectedSize: NSInteger) -> () in

    var progress = CGFloat(receivedSize) / CGFloat(expectedSize)
    self.progressView.updateProgress(progress)
}

and the callback for completed can be like this

var completed:SDWebImageCompletionBlock = { [weak self] (image:UIImage!, error:NSError!, cacheType:SDImageCacheType, imageUrl: NSURL!) in

    ...
    ...
    self.progressView.hidden = true
}

About

CircularProgressView by swift


Languages

Language:Swift 100.0%