scanner-overlay
scanner-overlay copied to clipboard
Adding a CAShapeLayer goes out of bounds
let path = CGMutablePath()
qrCodeView.clipsToBounds = true
view.clipsToBounds = true
path.addRect(videoPreviewLayer!.bounds)
path.addRect(qrCodeFrameView.frame)
let maskLayer = CAShapeLayer()
maskLayer.path = path
maskLayer.fillColor = UIColor.black.withAlphaComponent(0.6).cgColor
maskLayer.fillRule = .evenOdd
videoPreviewLayer?.addSublayer(maskLayer)
I have the above code but my path extends beyond the bounds of my qrCodeFrameView, what could be the problem.