I have a UIView
and I set a shadowPath
for it like this:
func addShadow() {
let cornerRadius: CGFloat = self.containerView.frame.height/2
self.containerView.layer.shadowPath = UIBezierPath(roundedRect: self.containerView.frame, cornerRadius: cornerRadius).cgPath
self.containerView.layer.shadowRadius = cornerRadius
self.containerView.layer.shadowOffset = .zero
self.containerView.layer.shadowOpacity = 0.2
self.containerView.layer.cornerRadius = cornerRadius
self.containerView.layer.shadowColor = UIColor(named: "whiteColor")?.cgColor
}
And this is whiteColor
:
And now my problem is
When I change the appearance of the phone, the
shadowPath
's color doesn't change automatically. What should I do to make the color dynamic?