Suggestion: Filter on FetchRequestController should not perform fetch
Closed this issue · 3 comments
I'd like to suggest that the filter(predicateClosure:)
function on FetchRequestController
should not automatically perform the fetch again.
I have two reasons for this:
- Initializing the
FetchRequestController
with a fetch request does not perform the fetch. The user would assume that adding a filter would have the same effect. The user already knows they must callperformFetch()
in one case. We should keep this consistent. - I have a use case in which I would like to add multiple new filters to my
FetchRequestController
simultaneously. Currently, it is performing the fetch multiple times unnecessarily. To get around that, I'm having to create myNSPredicate
manually and then use therefreshWithPredicate(_: keepOriginalPredicate:)
method.
Thoughts?
About all the filter related issues, I think it will be better to always have an option to performFetch or not, or remove the “auto fetching” and let the user decide where she/he wants to perform the fetch. Also it would be nice to think about the FetchRequestController
will fit the new Core Data features (WWDC 16) from now.
So you are open to a PR to make this change then? I'll go ahead and make a PR in the morning.
I haven't watched the Core Data sessions from WWDC yet, but I will very soon. We should probably open another ticket to discuss any suggested changes to fit the new features.
Yes. :-)
About the WWDC, I think the Core Data session will on Friday.