# .background()

[SwiftUI](https://lochiwei.gitbook.io/ios/swiftui) ⟩ [view](https://lochiwei.gitbook.io/ios/swiftui/view) ⟩ [drawing](https://lochiwei.gitbook.io/ios/swiftui/view/drawing) ⟩ <mark style="color:purple;">`.background()`</mark>

{% hint style="warning" %}
加入 *<mark style="color:purple;">**background**</mark>* <mark style="color:yellow;">不會改變</mark> [frame](https://lochiwei.gitbook.io/ios/swiftui/view/layout/frame/.frame)。
{% endhint %}

{% tabs %}
{% tab title="👥 相關" %}

* [.shadow](https://lochiwei.gitbook.io/ios/swiftui/shapes/shapestyle/.shadow "mention")
* container ⟩ [layout](https://lochiwei.gitbook.io/ios/swiftui/container/layout "mention") ⟩
  * &#x20;[layout](https://lochiwei.gitbook.io/ios/swiftui/container/layout/layout "mention")
  * [anylayout](https://lochiwei.gitbook.io/ios/swiftui/container/layout/anylayout "mention")
* [layout](https://lochiwei.gitbook.io/ios/swiftui/view/modifier/layout "mention")
* [types](https://lochiwei.gitbook.io/ios/swiftui/view/layout/types "mention")
  {% endtab %}

{% tab title="📘 手冊" %}

* [SwiftUI](https://developer.apple.com/documentation/swiftui) ⟩&#x20;
  * [View](https://developer.apple.com/documentation/swiftui/view) ⟩ [background(alignment:content:)](https://developer.apple.com/documentation/swiftui/view/background\(alignment:content:\))
  * [Layout](https://developer.apple.com/documentation/swiftui/layout-fundamentals) ⟩ [Adding a background to your view](https://developer.apple.com/documentation/swiftui/adding-a-background-to-your-view)
    {% endtab %}

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

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