 import QuartzCore
 
 class RoundedCornerView: UIView {
+
+    var borderColor:UIColor? = nil {
+        didSet {
+            if let borderColor = borderColor {
+                layer.borderColor = borderColor.CGColor
+            } else {
+                layer.borderColor = nil
+            }
+        }
+    }
+    
+    var borderWidth:CGFloat = 0.0 {
+        didSet {
+            layer.borderWidth = borderWidth
+        }
+    }
 
     var cornerRadius:CGFloat {
         set (radius) {

        super.init(coder: aDecoder)
        self.cornerRadius = 3.0
    }
    
}

extension CGRect {
    var center:CGPoint {
        return CGPointMake(CGRectGetMidX(self), CGRectGetMidY(self));
    }
    
    static func rectCenteredOn(center:CGPoint, radius:CGFloat) -> CGRect {
        return CGRectMake(floor(center.x - radius), floor(center.y - radius), floor(radius*2.0), floor(radius*2.0))
    }
}

class RoundImageView: UIImageView {
    
    func makeRound() {
        let minDimension:CGFloat = min(self.bounds.width, self.bounds.height)

    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        configure()
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        configure()
    }
    
    func configure() {
        makeRound()
        
        circlePathLayer.frame = bounds
        circlePathLayer.lineWidth = 2.0
        circlePathLayer.fillColor = UIColor.clearColor().CGColor
        circlePathLayer.strokeColor = UIColor.blackColor().CGColor
        layer.addSublayer(circlePathLayer)
    }    
}