views:

194

answers:

1

Hi,

I would like to execute some kind of subquery with my fetchedresultscontroller. I've got a set of items which have a flag like "viewed" or "not viewed". Is it possible to switch between these items... Sure I could do a complete refetch but this takes some time. Is there a better way for doing this?

Many thanks!

+1  A: 

One option would be to have two versions of your NSFetchedResultsController, one for viewed and one for not viewed. The trick is to make sure they use different cache files. This will allow the switching to be nearly instantaneous once the initial population of the cache is complete.

You can even set it up so that only one of these is in memory at a time to keep the overhead low. The trick is to make sure the cache names and fetch requests are consistent so that you do not trigger a cache reset.

Marcus S. Zarra