How can I clip a blur UIVisualEffectView with a PNG mask?

Viewed 527

I have a blurred UIVisualEffectView and would like to mask it with a PNG UIImage.

I have this code for now, but if I apply the mask, the view doesn't apply the blur effect anymore.

let maskLayer = CAShapeLayer()
maskLayer.contents = UIImage(named: "botnavbarmask")?.cgImage

let maskView = UIView(frame: self.view.frame)
maskView.backgroundColor = UIColor.black
maskView.layer.mask = maskLayer

blurBottom.mask = maskView

Is it even possible to apply a mask to the blur effect?

Any help is appreciated.

3 Answers
Related