<!--
{
  "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/View/defaultAppStorage(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE17defaultAppStorageyQrSo14NSUserDefaultsCF"
  },
  "title" : "defaultAppStorage(_:)"
}
-->

# defaultAppStorage(_:)

The default store used by `AppStorage` contained within the view.

```
nonisolated func defaultAppStorage(_ store: UserDefaults) -> some View
```

## Parameters

`store`

The user defaults to use as the default
store for `AppStorage`.

## Discussion

If unspecified, the default store for a view hierarchy is
`UserDefaults.standard`, but can be set a to a custom one. For example,
sharing defaults between an app and an extension can override the
default store to one created with `UserDefaults.init(suiteName:_)`.

---

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)