1 year ago

#388994

test-img

MarkCX

Storing Units in @AppStorage

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.

swiftui

unit-conversion

appstorage

0 Answers

Your Answer

Accepted video resources