Question

I have an entity called "Person" and a set of UIImages for it (One-To-Many). When the user enters the images, he's asked to do so in a chronological order to the person's life.

When I save & restore the data from Core Data, I need to keep the images order.

How would you suggest me to do it?

10x

Was it helpful?

Solution

Add and maintain a sortOrder attribute on your image entity. Add a sort descriptor for this attribute to keep images sorted by it. Core Data doesn't support ordered collections for performance reasons.

OTHER TIPS

In this case, the datetime the image was added is data that you're interested in, so it should be included in your model somewhere.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top