realm-swift
realm-swift copied to clipboard
Set oldValue in object notifications from changes performed on the same thread as the notification
Goals
Retrieve correct object change notifications
Expected Results
Get the oldValue and newValue properties set to the correct values
Actual Results
oldValue is always nil
Steps to Reproduce
Run the provided example project provided via e-mail
Version of Realm and Tooling
Realm version: 2.4.4
Xcode version: 8.2.1
iOS/OSX version: 10.12.3
Dependency manager + version: CocoaPods 1.2.1.beta.1
Thanks for filing this @rscholtes. I was able to reproduce the issue with the project you sent. As far as I understand this, this would be a bug. But I'd like @tgoyne to confirm in case there's something else at play here.
Thanks for the quick reply! If you require anything else, let me know
oldValue is not set if the write is made on the same thread as the notification and in your sample project all of the writes are being made on the main thread.
Right. Since I don't think we have a ticket tracking lifting that limitation, I'll convert this ticket to a feature request, although I don't think this is something we'll be doing in the near future.
Isn't there a single app that needs save/cancel logic in more than 1 screen? We have this functionality where you edit an object and all corresponding related objects and it is a real hell to manually duplicate the object and edit it outside the database and put it back. Why can't there be a normal manager similar to the Core Data Undo Manager?