You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes I want to use an underlying persistence strategy and add some extra mapping. But I never managed to make this work well. The latest use case would be NSSecureCoding on top of a (file or app storage) key. This should basically use the base key similar to the default key to load and subscribe and then transform the value with encoding / decoding via NSCoding. It should resurface underlying load / save errors in addition to errors from NSCoding, which can fail.
I would expect this to be simple, but I'm not sure how to hook into the base in order to transform things at the right time.
The underlying key's Value should be Data? as it can be nil and NSCoding works with Data.
The load and subscribe implementations should transform Data? <-> Anchor?, forward underlying errors, and set errors, if loading fails due to a thrown error in the archiving / unarchiving calls.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Sometimes I want to use an underlying persistence strategy and add some extra mapping. But I never managed to make this work well. The latest use case would be NSSecureCoding on top of a (file or app storage) key. This should basically use the base key similar to the default key to load and subscribe and then transform the value with encoding / decoding via NSCoding. It should resurface underlying load / save errors in addition to errors from NSCoding, which can fail.
I would expect this to be simple, but I'm not sure how to hook into the base in order to transform things at the right time.
The underlying key's Value should be Data? as it can be nil and NSCoding works with Data.
The load and subscribe implementations should transform Data? <-> Anchor?, forward underlying errors, and set errors, if loading fails due to a thrown error in the archiving / unarchiving calls.
Beta Was this translation helpful? Give feedback.
All reactions