> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/ios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/ios/swiftui/view/drawing/shadow/container-+-shadow.md).

# container + shadow

[SwiftUI](/ios/swiftui.md) ⟩ [view](/ios/swiftui/view.md) ⟩ [drawing](/ios/swiftui/view/drawing.md) ⟩ [shadow](/ios/swiftui/view/drawing/shadow.md) ⟩ container + shadow

{% hint style="info" %}

{% endhint %}

{% tabs %}
{% tab title="💾 程式" %}

```swift
VStack(spacing: 30) {
    Text("Hello")
    Image(systemName: "fish")
}
.foregroundColor(.teal)
.border(.teal, width: 3)
.background(.white) // 1. container + background color (如果沒加，還是會產生多個陰影)
.compositingGroup() // 2. compositing group ⭐️ 
.shadow(radius: 3, x: 6, y: 6)    // 3. 陰影
```

{% endtab %}

{% tab title="📗 參考" %}

* [ ] ChaoCode ⟩ [在 SwiftUI 中替 View 加上陰影](https://chaocode.co/blog/shadow-in-swiftui)&#x20;
  {% endtab %}
  {% endtabs %}
