Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates in CoreData NSManagedObject subclasses are not detected. #332

Open
alexkent opened this issue Aug 29, 2019 · 1 comment
Open

Updates in CoreData NSManagedObject subclasses are not detected. #332

alexkent opened this issue Aug 29, 2019 · 1 comment

Comments

@alexkent
Copy link

Hey all,
I'm fetching changes from CoreData with RxCoreData and displaying the in a UITableView with RxDataSources (4.0.1).
Add and remove operations work great.
But updates, changes to the content of a MSManagedObject subclass, are not triggering an update in the table view.

Looking in RxTableViewSectionedAnimatedDataSource I see that the oldSections and newSections arrays being passed to Differentiator are identical … so of course it can't spot any diffs.
The arrays are identical, I presume, because of the 'always up to date' behaviour of NSManagedObject subclasses.

Is there a simple way around this problem?

@alexkent
Copy link
Author

With some more thought, I guess there are two solutions;

  1. Accept the CoreData objects are mutable and self updating. Bind each cell's views to the NSManagedObject's properties directly. Then cells contents will update as the model object does and it doesn't matter that RxDataSources doesn't trigger the cell to update. Adds and Removes would still be handled by RxDataSources.
  2. Continue to pretend that CoreData objects are not mutable and self updating. Wrap the NSManagedObject subclass in a struct (or something) that also holds a static value (eg. a hash) computed from the values in the NSManagedObject at the moment of last signal from the Observable datasource. Then Differentiator will have something static to compute diffs from.

Anything I'm missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant