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

# view state

[SwiftUI](/ios/swiftui.md) ⟩ [view](/ios/swiftui/view.md) ⟩ state

{% hint style="success" %}
The [state](/ios/master/term/state.md) of a [view](/ios/swiftui/view.md).
{% endhint %}

{% tabs %}
{% tab title="🔴 主題" %}

* [state value](/ios/swiftui/view/state/value.md)：a value <mark style="color:yellow;">declared</mark> and <mark style="color:yellow;">initialized</mark> with [@State](/ios/swiftui/view/state/value/state.md).
* [state object](/ios/swiftui/view/state/object.md)：an [observable object](/ios/swiftui/view/state/observable-object/observableobject.md) that is <mark style="color:yellow;">declared</mark> and <mark style="color:yellow;">initialized</mark> as a [property](/ios/swift/type/prop.md) in a [view](/ios/swiftui/view.md).
  {% endtab %}

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

* [data model](/ios/master/term/data-model.md)
* [view actions](/ios/swiftui/view/action.md)
* some of a view's [environment values](/ios/swiftui/view/environment/value.md) automatically reflect <mark style="color:orange;">system state</mark>, <mark style="color:orange;">user settings</mark>, or <mark style="color:purple;">view state</mark>.
  {% endtab %}
  {% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/swiftui/view/state.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.
