I’ve got a bunch of managed objects that i’m fetching from a managed object context. These object have a imageFilePath attribute, which is just a path to an image data object ive saved to a directory on the phone. My question is this – what is the best way to batch convert all these data objects into an array of photos?
I’m considering just iterating thru the array of the managed objects, but that seems somewhat inefficient. I could also perhaps create a separate entity from this attribute in my model, and grab them directly.
Is there a way i could apply a block to each result of my fetch as it comes in?
thanks!
If you’re worried about the Core Data side of things, take a look at the
fetchBatchSizeyou can set onNSFetchRequest. You’ll have to experiment a bit to see what size will work best for you, but something like25is a good starting point. That way Core Data will not fetch all objects from disk at once, but fault them in 25 at a time. You still see a normalNSArrayand Core Data does all the magic in the background.