---
title: "init(_:store:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/appstorage/init(_:store:)"
---

# init(_:store:)

Creates a property that can read and write an Optional boolean user default.

## Declaration

```swift
init(_ key: String, store: UserDefaults? = nil) where Value == Bool?
```

## Parameters

- `key`: The key to read and write the value to in the user defaults store.
- `store`: The user defaults store to read and write to. A value of nil will use the user default store from the environment.

## Discussion

Discussion Defaults to nil if there is no restored value.

## See Also

### Storing a value

- [init(wrappedValue:_:store:)](swiftui/appstorage/init(wrappedvalue:_:store:).md)
