---
description: '#state'
---

# State

## Overview

Structs are normally Constant. You cannot change the value in it. But @State gives them that ability.

```swift
struct ContentView: View {
    @State var tapCount = 0

    var body: some View {
        Button("Tap Count: \(tapCount)") {
            tapCount += 1
        }
    }
}
```





## Sample Codes

```swift
```





## Sources

### Videos

{% embed url="https://youtu.be/FXSq_4xWtrc" %}



### Articles / Documents

* [Hacking with Swift / What is the @State property wrapper?](https://www.hackingwithswift.com/quick-start/swiftui/what-is-the-state-property-wrapper)

## See Also

* [observableobject](../main-pillars-protocol-class-struct-etc./protocols/observableobject "mention")
* [environmentobject](environmentobject "mention")
