I am trying to understand why applying a drop shadow to a SwiftUI Text View is different when using a “clear” color versus a non-clear one like “blue”.
#Preview {
VStack {
Text("Blue box")
.background(.blue)
// adds drop shadow to the bounding rectangle
.clipped()
.shadow(color: .black, radius: 2)
Text("Clear box")
.background(.clear)
// adds drop shadow to every letter
.clipped()
.shadow(color: .black, radius: 2)
Spacer()
}
.background(.yellow)
.padding()
}
The code above produces this