# ... as! ...

[Swift](../..) ⟩ [Pattern Matching](..) ⟩ [Sentence Patterns]() ⟩

{% hint style="info" %}
* <mark style="color:red;">**as!**</mark>: force type casting.
{% endhint %}

{% tabs %}
{% tab title="💈範例" %}
💾 程式： [mirror.handlechildren](../../debugging/mirror/mirror.handlechildren "mention")

```swift
// mirror self
let mirror = Mirror(reflecting: self)

//            ↱ child.label ignored        ╭─── ⭐ where clause ────╮
for case let (_, value) in mirror.children where value is Resettable {

    // ⭐ `as!` force type casting (from Any to Resettable)
    //    "where clause" ensures `value` IS `Resettable`!
    (value as! Resettable).reset()
}
```
{% endtab %}

{% tab title="👥 相關" %}
* [mirror.handlechildren](../../debugging/mirror/mirror.handlechildren "mention") - use <mark style="color:purple;">**`(... as! ...)`**</mark> sentence pattern.
{% endtab %}
{% endtabs %}
