Question: So I just started developing with SwiftUI and I'm running in a small problem. Subviews are also displaying superview's shadow, even if the superview has a background. Does someone know how to fix this?

```
HStack {
    HStack {
        [...]
    }
    .padding(.leading, 12.0)
    .padding(.trailing, 4.0)
    .padding(.vertical, 16.0)
    .background(Color("lightGreen"))
    .cornerRadius(10)
}
.padding(8)
.background(Color.white)
.shadow(color: Color("tabShadow"), radius: 0.0, x: 0.0, y: -0.5)
.shadow(color: Color("tabShadow"), radius: 0.0, x: 0.0, y: 0.5)

```

As stated, the first HStack's shadow shouldn't be replicated into the child one, but it is. Only the first one though. Any hints?

Answer: 
Certain modifiers, when placed on a stack, are inherited by all their children. For instance, if you have a stack containing a bunch of Text views, you can place one .font() modifier on the stack and they will all be modified.

It appears that .shadow() is one of those modifiers. As to why only one is inherited, I suspect that the designers of SwiftUI don't expect .shadow() to be called more than once on a particular view, and didn't test for that.

If you are just trying to get a colored line across the top and bottom of the view, maybe try something like

```
.background(Color.white)
.background(Color("tabShadow").offset(x: 0, y: -0.5))
.background(Color("tabShadow").offset(x: 0, y: 0.5))

```
You can try 'overlay' and 'background' tricks when you have to make them render in multiple passes. In above case, the overlay will not be affected by the shadow or other effects. 

If you think they are subViews, actually, they just render after the superView. It's a 2D world. So the overlay will be quite independently. 

The only problem is just the size of overlay. 

The hidden() is used here to occupy the position of invisible overlay. It's very cool if you master these layout skills.

```
struct ContentView: View {

var body: some View {

HStack {
    SubContentView().hidden()
}
.padding(8)
.background(Color.white)
.shadow(color: Color.red, radius: 0, x: 0.0, y: -0.5)
.shadow(color: Color.red, radius: 0, x: 0.0, y: 0.5)

.overlay(SubContentView())

}
}

struct SubContentView: View {
var body: some View {
    HStack{
               Text("a")
                Text("b")
                Text("c")
               Text("a")
               Text("b")
               Text("c")
           }.padding(.leading, 12.0)
           .padding(.trailing, 4.0)
           .padding(.vertical, 16.0)
           .background(Color.green)
           .cornerRadius(10)
}
}

```