<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/SceneStorage/init(wrappedValue:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI12SceneStorageV12wrappedValue_ACyxGx_SStcSYRzSi03RawF0Rtzlufc::OverloadGroup"
  },
  "title" : "init(wrappedValue:_:)"
}
-->

# init(wrappedValue:_:)

Creates a property that can save and restore an integer, transforming it
to a `RawRepresentable` data type.

```
init(wrappedValue: Value, _ key: String) where Value : RawRepresentable, Value.RawValue == Int
```

## Parameters

`wrappedValue`

The default value if an integer value is not
available for the given key.

`key`

a key used to save and restore the value.

## Discussion

A common usage is with enumerations:

```
enum MyEnum: Int {
    case a
    case b
    case c
}
struct MyView: View {
    @SceneStorage("MyEnumValue") private var value = MyEnum.a
    var body: some View { ... }
}
```

---

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)