In my project I need to send Realm Object in Request body. Before this operation, I need to replace some of values in object variables with another.
But I don't need to save new values, before I get success response from server.
In case when I don't opened transaction on changing I get error
'Attempting to modify object outside of a write transaction - call beginWriteTransaction on an RLMRealm instance first.'
So, is there any way to modify Realm object without instant saving, but rather 'saving on success' case?
You can begin a transaction using
realm.beginWrite()and make the changes you want to make. If server call is a success then you can commit the transactionrealm.commitWrite()or else cancel the transactionrealm.cancelWrite().