> 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/shadowstyle.md).

# ShadowStyle

(struct)

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

{% hint style="info" %} <mark style="color:purple;">`ShadowStyle`</mark>\ <mark style="color:yellow;">陰影樣式</mark> (目前只出現在 [ShapeStyle](/ios/swiftui/shapes/shapestyle.md) 的<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](/ios/swiftui/shapes/shapestyle.md)：
  * <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](/ios/swiftui/shapes/shapestyle.md) 的 <mark style="color:orange;">instance</mark> 加<mark style="color:yellow;">陰影</mark>
* [view.shadow()](/ios/swiftui/view/drawing/shadow/view.shadow.md)
* [.shadowedBorder()](/ios/swiftui/view/view/.shadowedborder.md)
  {% 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 %}
