Storing Units in @AppStorage

50 views Asked by At

I need to store a user's chosen selection of 11 different measurement units in AppStorage.

Ideally something equivalent to:

@AppStorage("shortDistance") var shortDistance: UnitLength = .meters

I understand why this won't work, but need to do this as painlessly as possible as I need to access these in multiple places in my app. I need to be able to do various conversions on the units which are stored in CoreData as SI units.

Thanks, Mark.

0

There are 0 answers