AppStorageKey.swift 419 B

1234567891011
  1. /// A type safe key for ``AppStorageValues`` properties, similar in spirit
  2. /// to ``EnvironmentKey``.
  3. /// Properties can be accessed using the ``AppStorage`` property wrapper.
  4. public protocol AppStorageKey<Value> {
  5. associatedtype Value: Codable
  6. /// The name to use when persisting the key.
  7. static var name: String { get }
  8. /// The default value for the key.
  9. static var defaultValue: Value { get }
  10. }