SharedKey that rolls back changes on failed save #170
Unanswered
johnpatrickmorgan
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I’m starting to use
swift-sharing
with a custom SharedKey that interacts with a backend. It works really well but there’s one sticking point. The saving can fail, and if it does, I’d like the shared value to revert to what it was before the save was attempted. I found I could achieve this behaviour by wrapping the key, but I’m not sure if I’m overlooking a simpler solution, or if I’m trying to make the library behave in a way that’s not intended. Thanks in advance for any insight!Example of what I mean by a wrapper:
https://gist.github.com/johnpatrickmorgan/aeee23d87645711689da06ee041a2d41#file-rollingbacksharedkey-swift
Beta Was this translation helpful? Give feedback.
All reactions