I'm using xcode 12. I wrote extension UI View as below:
@IBInspectable
public var shadowRadius: CGFloat {
get {
return layer.shadowRadius
}
set {
layer.shadowRadius = newValue
}
}
@IBInspectable
public var shadowOpacity: Float {
get {
return layer.shadowOpacity
}
set {
layer.shadowOpacity = newValue
}
}
@IBInspectable
public var shadowOffset: CGSize {
get {
layer.shadowOffset
}
set {
layer.shadowOffset = newValue
}
}
@IBInspectable
public var shadowColor: UIColor {
get {
return UIColor(cgColor: layer.shadowColor ?? UIColor.clear.cgColor)
}
set {
layer.shadowColor = newValue.cgColor
}
}
Things works fine but when I debug view, I saw some purple warnings like this.
x-xcode-debug-views://7f8fd2258020?DBGViewDebuggerLaunchSessionParameter=7f8fd2258020: runtime: Optimization Opportunities: The layer is using dynamic shadows which are expensive to render. If possible try setting
shadowPath, or pre-rendering the shadow into an image and putting it under the layer.
Can someone explain this to me and help me to get rid of it??
