# ... as! ...

[Swift](/ios/swift.md) ⟩ [Pattern Matching](/ios/swift/pattern-matching.md) ⟩ [Sentence Patterns](/ios/swift/pattern-matching/sentence-patterns.md) ⟩

{% hint style="info" %}

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

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

```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()](/ios/swift/debugging/mirror/mirror.handlechildren.md) - use <mark style="color:purple;">**`(... as! ...)`**</mark> sentence pattern.
  {% endtab %}
  {% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lochiwei.gitbook.io/ios/swift/pattern-matching/sentence-patterns/...-as-....md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
