<!--
{
  "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",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI12SceneStorageV"
  },
  "title" : "SceneStorage"
}
-->

# SceneStorage

A property wrapper type that reads and writes to persisted, per-scene
storage.

```
@frozen @propertyWrapper struct SceneStorage<Value>
```

## Overview

You use `SceneStorage` when you need automatic state restoration of the
value.  `SceneStorage` works very similar to `State`, except its initial
value is restored by the system if it was previously saved, and the value is
shared with other `SceneStorage` variables in the same scene.

The system manages the saving and restoring of `SceneStorage` on your
behalf. The underlying data that backs `SceneStorage` is not available to
you, so you must access it via the `SceneStorage` property wrapper. The
system makes no guarantees as to when and how often the data will be
persisted.

Each `Scene` has its own notion of `SceneStorage`, so data is not shared
between scenes.

Ensure that the data you use with `SceneStorage` is lightweight. Data of a
large size, such as model data, should not be stored in `SceneStorage`, as
poor performance may result.

If the `Scene` is explicitly destroyed (e.g. the switcher snapshot is
destroyed on iPadOS or the window is closed on macOS), the data is also
destroyed. Do not use `SceneStorage` with sensitive data.

## Topics

### Storing a value

[`init(wrappedValue:_:)`](/documentation/SwiftUI/SceneStorage/init(wrappedValue:_:))

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

[`init(_:)`](/documentation/SwiftUI/SceneStorage/init(_:))

Creates a property that can save and restore an Optional boolean.

### Getting the value

[`wrappedValue`](/documentation/SwiftUI/SceneStorage/wrappedValue)

The underlying value referenced by the state variable.

[`projectedValue`](/documentation/SwiftUI/SceneStorage/projectedValue)

A binding to the state value.



---

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)