appStorage(_:store:)

Creates a shared key that can read and write to an optional string user default, transforming that to a RawRepresentable data type.

AppStorageKey.swift:237
static func appStorage<Value>(_ key: String, store: UserDefaults? = nil) -> Self where Self == AppStorageKey<Value?>, Value : RawRepresentable, Value : Sendable, Value.RawValue == String

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 dependencies.

Returns

A user defaults shared key.