Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Pod/Classes/VerticalProgressView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import UIKit
public class VerticalProgressView : UIView {

@IBInspectable public var cornerRadius: CGFloat = 12;
@IBInspectable public var fillDoneColor : UIColor = UIColor.blueColor()
@IBInspectable public var fillDoneColor : UIColor = UIColor.blue
//@IBInspectable public var fillUndoneColor: UIColor = UIColor(red: 0, green: 0, blue: 1, alpha: 0.1)
//@IBInspectable var fillRestColor : UIColor = UIColor.whiteColor()
@IBInspectable public var animationDuration: Double = 0.5
Expand All @@ -23,7 +23,7 @@ public class VerticalProgressView : UIView {
return self.progressPriv
}
set{
self.setProgress(newValue, animated: self.animationDuration > 0.0)
self.setProgress(progress: newValue, animated: self.animationDuration > 0.0)
}
}

Expand All @@ -35,7 +35,7 @@ public class VerticalProgressView : UIView {
super.layoutSubviews()
if self.filledView == nil {
self.filledView = CALayer()
self.filledView!.backgroundColor = self.fillDoneColor.CGColor
self.filledView!.backgroundColor = self.fillDoneColor.cgColor
self.layer.addSublayer(filledView!)
}
self.filledView!.frame = self.bounds
Expand All @@ -48,12 +48,12 @@ public class VerticalProgressView : UIView {
else if(self.progressPriv > 1) { progressPriv = 1}
}

override public func drawRect(rect: CGRect) {
super.drawRect(rect)
override public func draw(_ rect: CGRect) {
super.draw(rect)
let filledHeight = rect.size.height * CGFloat(self.progressPriv)
self.setLayerProperties()
let y = self.frame.size.height - filledHeight
self.filledView!.frame = CGRectMake(0, y, rect.size.width, rect.size.height)
self.filledView!.frame = CGRect(x: 0, y: y, width: rect.size.width, height: rect.size.height)

}

Expand All @@ -72,7 +72,7 @@ public class VerticalProgressView : UIView {
func setFilledPosition(position: CGFloat, animated: Bool) {
if self.filledView == nil { return }
//animated
let duration: NSTimeInterval = animated ? self.animationDuration : 0;
let duration: TimeInterval = animated ? self.animationDuration : 0;
CATransaction.begin()
CATransaction.setAnimationDuration(duration)
self.filledView!.frame.origin.y = position
Expand All @@ -87,9 +87,9 @@ public class VerticalProgressView : UIView {
else if val > 1 { val = 1 }
self.progressPriv = val

setFilledPosition(self.shouldHavePosition(), animated: animated)
setFilledPosition(position: self.shouldHavePosition(), animated: animated)
}



}
}