<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/State/init(wrappedValue:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI5StateV12wrappedValueACyxGx_tcfc"
  },
  "title" : "init(wrappedValue:)"
}
-->

# init(wrappedValue:)

Creates a state property that stores an initial wrapped value.

```
init(wrappedValue value: Value)
```

## Parameters

`value`

An initial value to store in the state
property.

## Discussion

You don’t call this initializer directly. Instead, SwiftUI
calls it for you when you declare a property with the `@State`
attribute and provide an initial value:

```
struct MyView: View {
    @State private var isPlaying: Bool = false

    // ...
}
```

SwiftUI initializes the state’s storage only once for each
container instance that you declare. In the above code, SwiftUI
creates `isPlaying` only the first time it initializes a particular
instance of `MyView`. On the other hand, each instance of `MyView`
creates a distinct instance of the state. For example, each of
the views in the following [`VStack`](/documentation/SwiftUI/VStack) has its own `isPlaying` value:

```
var body: some View {
    VStack {
        MyView()
        MyView()
    }
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)