Is it possible to create a shadow around a UIVisualView using a UIBlurEffect, without allowing the UIVisualView to be colored by the shadow below it?
I just want the shadow around the view, but with this code, the shadow will cover the whole view, which darkens the whole view:
let borderPath = UIBezierPath(roundedRect: view.bounds, byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize(width: 15, height: 15)).cgPath shadowView.frame = view.bounds shadowView.autoresizingMask = [.flexibleWidth, .flexibleHeight] shadowView.layer.shadowOpacity = 0.3 shadowView.layer.shadowRadius = 3.0 shadowView.backgroundColor = UIColor.clear shadowView.layer.shadowPath = borderPath shadowView.layer.shadowOffset = CGSize(width: 0, height: 0) self.view.insertSubview(shadowView, at: 0) let blurEffect = UIBlurEffect(style: .extraLight) let blurView = UIVisualEffectView(effect: blurEffect) blurView.frame = view.bounds blurView.autoresizingMask = [.flexibleWidth, .flexibleHeight] blurView.clipsToBounds = true blurView.layer.cornerRadius = 15 view.insertSubview(blurView, aboveSubview: shadowView)
EDIT.
I need to achieve the same as in the Apple Maps application. Where the dragged favorite view uses both the UIVisualEffectView and the shadow around its top, without interfering with the background of the UIVisualEffectView.
See screenshot examples:

source share