     //scaling :http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F15643626%2Fscale-cgpath-to-fit-uiview&sa=D&sntz=1&usg=AFQjCNGKPDZfy0-_lkrj3IfWrTGp96QIFQ
     //nice answer from David Rönnqvist!
     class func rescaleForFrame(path: CGPath, frame: CGRect) -> CGPath {
-        let boundingBox            = CGPathGetBoundingBox(path)
-        let boundingBoxAspectRatio = CGRectGetWidth(boundingBox)/CGRectGetHeight(boundingBox)
-        let viewAspectRatio        = CGRectGetWidth(frame)/CGRectGetHeight(frame)
+        let boundingBox            = path.boundingBox
+        let boundingBoxAspectRatio = boundingBox.width/boundingBox.height
+        let viewAspectRatio        = frame.width/frame.height
         
         var scaleFactor: CGFloat = 1.0
         if (boundingBoxAspectRatio > viewAspectRatio) {
-            scaleFactor = CGRectGetWidth(frame)/CGRectGetWidth(boundingBox)
+            scaleFactor = frame.width/boundingBox.width
         } else {
-            scaleFactor = CGRectGetHeight(frame)/CGRectGetHeight(boundingBox)
-        }
-        
-        var scaleTransform = CGAffineTransformIdentity
-        scaleTransform     = CGAffineTransformScale(scaleTransform, scaleFactor, scaleFactor)
-        scaleTransform     = CGAffineTransformTranslate(scaleTransform, -CGRectGetMinX(boundingBox), -CGRectGetMinY(boundingBox))
-        let scaledSize     = CGSizeApplyAffineTransform(boundingBox.size, CGAffineTransformMakeScale(scaleFactor, scaleFactor))
-        let centerOffset   = CGSizeMake((CGRectGetWidth(frame)-scaledSize.width)/(scaleFactor*2.0), (CGRectGetHeight(frame)-scaledSize.height)/(scaleFactor*2.0))
-        scaleTransform     = CGAffineTransformTranslate(scaleTransform, centerOffset.width, centerOffset.height)
-        
-        if let resultPath = CGPathCreateCopyByTransformingPath(path, &scaleTransform) {
+            scaleFactor = frame.height/boundingBox.height
+        }
+        
+        var scaleTransform = CGAffineTransform.identity
+        scaleTransform     = scaleTransform.scaledBy(x: scaleFactor, y: scaleFactor)
+        scaleTransform     = scaleTransform.translatedBy(x: -boundingBox.minX, y: -boundingBox.minY)
+        let scaledSize     = boundingBox.size.applying(CGAffineTransform(scaleX: scaleFactor, y: scaleFactor))
+        let centerOffset   = CGSize(width:(frame.width-scaledSize.width)/(scaleFactor*2.0), height:(frame.height-scaledSize.height)/(scaleFactor*2.0))
+        scaleTransform     = scaleTransform.translatedBy(x: centerOffset.width, y: centerOffset.height)
+        
+        if let resultPath = path.copy(using: &scaleTransform) {
             return resultPath
         }
         

                strokeStart    = animations.strokeStart
                strokeEnd      = animations.strokeEnd
            }
            onOffLayer.applyAnimation(strokeStart)
            onOffLayer.applyAnimation(strokeEnd)
        }
    }
    

        }
    }
    
    @IBInspectable public var strokeColor: UIColor = UIColor.white {
        didSet {
            updateProperties()
        }
