 
 class MaskView: UIVisualEffectView {
 
+    override init(effect: UIVisualEffect?) {
+        super.init(effect: effect)
+    }
+
+    required init?(coder aDecoder: NSCoder) {
+        super.init(coder: aDecoder)
+    }
+
     var maskPath: Mask? {
         didSet {
             self.updateMask()

        }
    }

    override func layoutSubviews() {
        super.layoutSubviews()
        self.updateMask()
    }

    fileprivate lazy var maskLayer: CAShapeLayer = {
        let mask = CAShapeLayer()
        mask.fillRule = kCAFillRuleEvenOdd
        return mask
    }()

    fileprivate func updateMask() {
        if self.layer.mask == nil {
            self.layer.mask = self.maskLayer
        }

        let maskRect = self.maskRect ?? self.bounds
        let clipPath = self.maskPath?.path(in: maskRect) ?? UIBezierPath(ovalIn: maskRect)


        path.addRect(self.bounds)
        path.addPath(clipPath.cgPath)

        maskLayer.path = path
        self.mask = theMaskView
    }
}
