The best comparison I can make is that of the iPhone Contacts app that comes with all phones.
When the user starts the app it lists all the contacts. A user can select a contact and the "Detail View" for the contact is shown. Lastly, the user can then select to edit the contact and goes to an "Edit Detail View". Simple...
One of the features I have in my app is exactly the same thing.
I present a list to a user and the user can click on any items on the list.
Once they click the item they can view the details for that item on the "Detail View".
User has the ability to 'Edit' the items where now they can enter modifications to the item via text fields in the "Edit Detail View".
The user now can 'Save' or 'Cancel' their modifications/edits if they want to, which would navigate them back to the "Detail View".
Again Simple just like the Contacts app.
So here is the issue: The 'Save' works flawlessly since I'm passing the Object as a Binding variable:
@Binding var cigar: Cigar
When a text field is changed, the modification will reflect the change back in the "Detail View" after the user presses 'Save', which is the desired outcome.
The issue tho is that even if the user clicks 'Cancel' the changes in the text field are still quote-unquote "saved", which is no the desired outcome. I imagine that is because I am using a @Binding variable and the variable changes in realtime.
So my question is, is there any way to "unbind" or discard the changes that were made to a @Binding variable/object when the user clicks 'Cancel' or wants to discard the changes/edits they made?
Can some please help, or if you can suggest a better approach to achieve the outcome.