---
description: (struct)
---

# ShadowStyle

[SwiftUI](../../..) ⟩ [view](../..) ⟩ [drawing](..) ⟩ [shadow]() ⟩ <mark style="color:purple;">`ShadowStyle`</mark>

{% hint style="info" %}
<mark style="color:purple;">`ShadowStyle`</mark>\ <mark style="color:yellow;">陰影樣式</mark> (目前只出現在 [shapestyle](../../../shapes/shapestyle "mention") 的<mark style="color:yellow;">兩個</mark> <mark style="color:blue;">`shadow()`</mark> 的參數中)。
{% endhint %}

{% hint style="warning" %}
<mark style="color:blue;">`ShapeStyle`</mark> 有兩個 <mark style="color:blue;">`shadow()`</mark>❗️

* <mark style="color:blue;">`ShapeStyle.shadow()`</mark> ： <mark style="color:orange;">type method</mark>：爲 <mark style="color:orange;">current style</mark> 加<mark style="color:yellow;">陰影</mark>。
* <mark style="color:blue;">`style.shadow()`</mark> ： <mark style="color:orange;">instance method</mark>：爲 <mark style="color:blue;">`ShapeStyle`</mark> <mark style="color:orange;">instance</mark> 加<mark style="color:yellow;">陰影</mark>。
{% endhint %}

{% tabs %}
{% tab title="💾 程式" %}
```swift
// Color 遵循 ShapeStyle, 因此 .blue 可呼叫 .shadow() (instance method)
// shape.fill(shapeStyle_withShadow)
Circle()
    // 藍色＋陰影       ╭─⭐️ShadowStyle─╮
    .fill(.blue.shadow(.drop(radius: 10)))
```
{% endtab %}

{% tab title="🔴 主題" %}
* Type methods：
  * [.inner()](https://developer.apple.com/documentation/swiftui/shadowstyle/inner\(color:radius:x:y:\)) ：<mark style="color:yellow;">內陰影</mark> (inner shadow).
  * [.drop()](https://developer.apple.com/documentation/swiftui/shadowstyle/drop\(color:radius:x:y:\))：<mark style="color:yellow;">外陰影</mark> (drop shadow).
{% endtab %}

{% tab title="👥 相關" %}
* [shapestyle](../../../shapes/shapestyle "mention")：
  * <mark style="color:orange;">type method</mark> [.shadow()](https://developer.apple.com/documentation/swiftui/shapestyle/shadow\(_:\)-swift.type.method) ：爲 <mark style="color:orange;">current style</mark> 加<mark style="color:yellow;">陰影</mark>
  * <mark style="color:orange;">instance method</mark> [.shadow()](https://developer.apple.com/documentation/swiftui/shapestyle/shadow\(_:\)-swift.method) ：爲 [ShapeStyle](../../../shapes/shapestyle) 的 <mark style="color:orange;">instance</mark> 加<mark style="color:yellow;">陰影</mark>
* [view.shadow](view.shadow "mention")
* [.shadowedborder](../../view/.shadowedborder "mention")
{% endtab %}

{% tab title="📘 手冊" %}
* [SwiftUI](https://developer.apple.com/documentation/swiftui) ⟩ [Drawing and graphics](https://developer.apple.com/documentation/swiftui/drawing-and-graphics) ⟩ [ShadowStyle](https://developer.apple.com/documentation/swiftui/shadowstyle) ⟩&#x20;
  * [.inner(color:radius:x:y:)](https://developer.apple.com/documentation/swiftui/shadowstyle/inner\(color:radius:x:y:\)) ：custom inner shadow style.
{% endtab %}

{% tab title="📗 參考" %}
* StackOverflow ⟩ [an instance calls a static method?](https://stackoverflow.com/q/79325050/7185426)&#x20;
{% endtab %}
{% endtabs %}
