Shadows

Shadows are expensive and should be used with moderation. A tip from the Design Guidelines: "Minimal use of bezels, gradients, and drop shadows keep the interface light and airy, while ensuring that content is paramount."

let shadowPath = UIBezierPath(rect: bounds)
    layer.masksToBounds = false
    layer.shadowColor = UIColor.black.cgColor
    layer.shadowOffset = CGSize(width: 0.0, height: 5.0)
    layer.shadowOpacity = 0.5
    layer.shadowRadius = 4.0
    layer.shadowPath = shadowPath.cgPath

Performance Considerations

Just like round borders, shadows can have a detrimental performance effect when used a lot, especially in lists (table views). It's best to minimize the use of shadows in table view cells, in order to maintain 60 frames per second and a good user experience.

Last updated