     /// If not specified, `startColor` with 15% opacity will be used.
     @IBInspectable open var backgroundRingColor: UIColor? {
         get {
-            if let color = (layer as! MKRingProgressLayer).backgroundRingColor {
+            if let color = ringProgressLayer.backgroundRingColor {
                 return UIColor(cgColor: color)
             }
             return nil
         }
         set {
-            (layer as! MKRingProgressLayer).backgroundRingColor = newValue?.cgColor
+            ringProgressLayer.backgroundRingColor = newValue?.cgColor
         }
     }
     
     /// The width of the progress ring. Defaults to `20`.
     @IBInspectable open var ringWidth: CGFloat {
         get {
-            return (layer as! MKRingProgressLayer).ringWidth
-        }
-        set {
-            (layer as! MKRingProgressLayer).ringWidth = newValue
+            return ringProgressLayer.ringWidth
+        }
+        set {
+            ringProgressLayer.ringWidth = newValue
         }
     }
     

        super.init(layer: layer)
        setup()
    }

    required public init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        setup()

        let shadowOffset = CGSize(width: w/10 * cos(angle + angleOffset), height: w/10 * sin(angle + angleOffset))
        ctx.setShadow(offset: shadowOffset, blur: w/3, color: UIColor(white: 0.0, alpha: endShadowOpacity).cgColor)
        let arcEnd = CGPoint(x: c.x + r * cos(angle1), y: c.y + r * sin(angle1))
        
        let shadowPath: UIBezierPath
        
        switch progressStyle {
        case .round:
            shadowPath = UIBezierPath(ovalIn: CGRect(x: arcEnd.x - w/2, y: arcEnd.y - w/2, width: w, height: w))
        case .square:
            shadowPath = UIBezierPath(rect: CGRect(x: arcEnd.x - w/2, y: arcEnd.y - 2, width: w, height: 2))
            shadowPath.apply(CGAffineTransform(translationX: -arcEnd.x, y: -arcEnd.y))
            shadowPath.apply(CGAffineTransform(rotationAngle: angle1))
            shadowPath.apply(CGAffineTransform(translationX: arcEnd.x, y: arcEnd.y))
        }
        
        ctx.addPath(shadowPath.cgPath)
        ctx.setFillColor(endColor)
        ctx.fillPath()
        
        ctx.restoreGState()
