Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Refactor SSFilterableFetchedResultsController filter updates. #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

maxmeyers
Copy link

Currently, whenever there's an change in the filter in a SSFilterableFetchedResultsController, the entire table is deleted and the new results are filtered.

With this change, only objects that do not pass the new filter are deleted, objects that pass both filters are moved if necessary, and objects that only pass the new filter (but not the old one) are inserted.

Thanks for all your hard work on this project! It seriously helped my understanding and use of CoreData.

@soffes
Copy link
Owner

soffes commented Nov 20, 2013

Thanks! Definitely a better approach.

I'll merge when I get a chance to test it. Want to make sure it's solid before releasing.

@maxmeyers
Copy link
Author

Cool, thanks!

@maxmeyers
Copy link
Author

I added a couple more changes.

First, in ab618ca, I added an accessor to get the unfiltered fetchedObjects. This is useful, for example, when there's a filter in place but you still want to know how many objects there are in the total list.

Secondly, in 2c5fecc, I did an overhaul of how updates to the objects in the NSFetchedResultsController are propagated to the delegate when a filter is in place. There are logical considerations for each CRUD command that depend on the filter.

@soffes
Copy link
Owner

soffes commented Nov 29, 2013

Any chance you can write tests for this stuff? I'd love to have confidence with this junk going forward.

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

Successfully merging this pull request may close these issues.

2 participants