diff --git a/Pod/Classes/VerticalProgressView.swift b/Pod/Classes/VerticalProgressView.swift index 7149c58..ab3ae61 100644 --- a/Pod/Classes/VerticalProgressView.swift +++ b/Pod/Classes/VerticalProgressView.swift @@ -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 @@ -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) } } @@ -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 @@ -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) } @@ -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 @@ -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) } -} \ No newline at end of file +}