Save Custom Codable Types in AppStorage or SceneStorage

Save Custom Codable Types in AppStorage or SceneStorage

On iOS 14 we have two new property wrappers in SwiftUI: AppStorage and SceneStorage. AppStorage is usually used to persist some user specific settings and SceneStorage is designed for state restoration.

[…]

Once our type conforms to RawRepresentable we can use it with AppStorage or SceneStorage.

[…]